boxfox619 / CC-Show-New

Web tech based presentation tool - CC Show
3 stars 0 forks source link

Why enzyme? & enzyme shallow vs mount #1

Open boxfox619 opened 5 years ago

boxfox619 commented 5 years ago
boxfox619 commented 5 years ago

Shallow

진정한 단위 테스트 (격리된, 자식 렌더링 X)

Simple Shallow

Calls:

Shallow + setProps

Calls:

Shallow + unmount

Calls:

Mount

Simple mount

Calls:

Mount + setProps

Calls:

Mount + unmount

Calls:

Render

오직 render 함수만 호출하며 모든 자식까지 렌더링한다.

Shallow vs Mount vs Render

Enzyme V3 부터는 shallow도 componentDidMount, componentDidUpdate라이프사이클을 호출함 https://github.com/airbnb/enzyme/blob/master/docs/api/shallow.md

참고자료 : https://gist.github.com/fokusferit/e4558d384e4e9cab95d04e5f35d4f913

boxfox619 commented 5 years ago

Why enzyme?

boxfox619 commented 5 years ago

https://medium.com/codeclan/testing-react-with-jest-and-enzyme-20505fec4675