728x90 반응형 jest1 [Jest] Axios undefined 해결하기 with.mock Axios로 통신하여 데이터를 잘 가져오는지 확인하기 위해 테스트 코드를 작성했다. 하지만 예상과 달리 결과값이 undefined였다. 공식문서를 확인해보니 axios를 테스트하기 위해서는 jest.mock를 써줘야했다. 공식문서 : https://jestjs.io/docs/mock-functions#mocking-modules Mock Functions · Jest Mock functions allow you to test the links between code by erasing the actual implementation of a function, capturing calls to the function (and the parameters passed in those calls), capturi.. 2022. 9. 14. 이전 1 다음 728x90 반응형