관리 메뉴

프론트엔드 정복하기

테스트코드 작성기 본문

테스팅 라이브러리

테스트코드 작성기

GROWNFRESH 2021. 12. 13. 18:48

useNavigation 테스트코드 작성하는 법

https://stackoverflow.com/questions/61781274/how-to-mock-usenavigation-hook-in-react-navigation-5-0-for-jest-test

 

How to mock useNavigation hook in react-navigation 5.0 for jest test?

i want to mock useNavigation hook used inside my functional component. Any workaround how to mock it using jest? import React from 'react'; import { useNavigation } from '@react-navigation/native';

stackoverflow.com

https://spin.atomicobject.com/2021/02/24/react-navigation-5-unit-testing-components/

 

Unit Testing Components in React Navigation 5

Testing components that use the "useNavigation" hook can be complicated. Here are a few options to make testing these components easier.

spin.atomicobject.com

 

'테스팅 라이브러리' 카테고리의 다른 글

TDD | API 및 hook 테스트  (0) 2021.12.24