code link : cartsReducer test




In Redux, action creators are functions which return plain objects. Our recommendation is not to write action creators manually, but instead have them generated automatically by createSlice, or created via createAction from @reduxjs/toolkit. As such, you should not feel the need to test action creators by themselves (the Redux Toolkit maintainers have already done that for you!).

와우! 액션 생성에 대한 테스트는 할 필요가 없다고 한다. createSlice, createAction에서 스스로 생성해주기 때문... 이미 rtk에서 테스트를 했다고하니 믿고 테스트하지 않아도 될 것 같다...

cartsSlice 코드

Screen Shot 2022-03-15 at 2.38.55 PM.jpg

cartReducer.test 코드

Screen Shot 2022-03-15 at 2.41.25 PM.jpg

Screen Shot 2022-03-15 at 2.41.33 PM.jpg