Files
lnreader/__mocks__/react-navigation.js
T
Patrick Loser 1803cd071d feat: Add testing support for react code (#1763)
* first attempt

* first attempt

* added first useNovel tests

* more tests

* more tests

* resolved all test issues

* added test-utils

* add a few component tests

* add TESTIGN.md

* add testing gh action

* fixed minor issues

* fixed minor issues
2026-02-25 14:51:46 +01:00

30 lines
704 B
JavaScript

const mockNavigate = jest.fn();
const mockSetOptions = jest.fn();
jest.mock('react-native-worklets', () =>
require('react-native-worklets/src/mock'),
);
// Include this line for mocking react-native-gesture-handler
require('react-native-gesture-handler/jestSetup');
// Include this section for mocking react-native-reanimated
const { setUpTests } = require('react-native-reanimated');
setUpTests();
jest.mock('@react-navigation/native', () => {
return {
useFocusEffect: jest.fn(),
useNavigation: () => ({
navigate: mockNavigate,
setOptions: mockSetOptions,
}),
useRoute: () => ({
params: {},
}),
};
});
module.exports = { mockNavigate, mockSetOptions };