Skip to content

Instantly share code, notes, and snippets.

@ddikodroid
Forked from xiongemi/test-setup.ts
Created November 14, 2022 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddikodroid/3cc020103a0e7c5957d55934766a2aba to your computer and use it in GitHub Desktop.
Save ddikodroid/3cc020103a0e7c5957d55934766a2aba to your computer and use it in GitHub Desktop.
mock @react-navigation/native for unit testing
jest.mock('@react-navigation/native', () => {
return {
useNavigation: () => ({
navigate: jest.fn(),
dispatch: jest.fn(),
}),
useRoute: () => ({
params: {
id: '123',
},
}),
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment