Skip to content

Commit

Permalink
add jest support
Browse files Browse the repository at this point in the history
  • Loading branch information
b4s36t4 committed Oct 9, 2023
1 parent e994d78 commit f3ef79f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jest/setup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'setimmediate';
import 'react-native-gesture-handler/jestSetup';
import * as reanimatedJestUtils from 'react-native-reanimated/src/reanimated2/jestUtils';
import mockClipboard from '@react-native-clipboard/clipboard/jest/clipboard-mock';
import setupMockImages from './setupMockImages';

setupMockImages();
Expand All @@ -10,6 +11,10 @@ reanimatedJestUtils.setUpTests();
// https://reactnavigation.org/docs/testing/#mocking-native-modules
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');

// Clipboard requires mocking as NativeEmitter will be undefined with jest-runner.
// https://github.com/react-native-clipboard/clipboard#mocking-clipboard
jest.mock('@react-native-clipboard/clipboard', () => mockClipboard);

// Mock react-native-onyx storage layer because the SQLite storage layer doesn't work in jest.
// Mocking this file in __mocks__ does not work because jest doesn't support mocking files that are not directly used in the testing project,
// and we only want to mock the storage layer, not the whole Onyx module.
Expand Down

0 comments on commit f3ef79f

Please sign in to comment.