Created
May 28, 2020 05:53
-
-
Save SebinLee/b87aed664e2c5fe08b9f05b5f725b765 to your computer and use it in GitHub Desktop.
React Testing Recipe 번역 - Setup/Teardown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { unmountComponentAtNode } from "react-dom"; | |
let container = null; | |
beforeEach(() => { | |
// 렌더 타겟으로 사용할 DOM 요소를 생성합니다. | |
container = document.createElement("div"); | |
document.body.appendChild(container); | |
}); | |
afterEach(() => { | |
// 테스트를 종료할 때 요소들을 삭제합니다. | |
unmountComponentAtNode(container); | |
container.remove(); | |
container = null; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment