-
Notifications
You must be signed in to change notification settings - Fork 27
(Jest, Enzyme) 컴포넌트 단위, 통합 테스트
Sungdong Jo edited this page Nov 13, 2019
·
4 revisions
import { doIncrement, doDecrement } from './App';
describe('Local State', () => {
it('should increment the counter in state', () => {
const state = { counter: 0 };
const newState = doIncrement(state);
expect(newState.counter).to.equal(1);
});
it('should decrement the counter in state', () => {
const state = { counter: 0 };
const newState = doDecrement(state);
expect(newState.counter).to.equal(-1);
});
});
describe('App Component', () => {
it('Counter 래퍼를 그려낸다', () => {
const wrapper = shallow(<App />);
expect(wrapper.find(Counter)).to.have.length(1);
});
it('Counter 래퍼에 모든 Prop이 전달되었다', () => {
const wrapper = shallow(<App />);
let counterWrapper = wrapper.find(Counter);
expect(counterWrapper.props().counter).to.equal(0);
wrapper.setState({ counter: -1 });
counterWrapper = wrapper.find(Counter);
expect(counterWrapper.props().counter).to.equal(-1);
});
});
실용적인 리액트 테스트 전략
DevOps
Infra Structure
컴포넌트 작성법
Client Sturcture
데이터베이스 스키마
Yarn workspace 명령어
Docker를 이용한 서버 개발 환경
Linting Tools