77be5624f2
* Add native share intent handling module * Handle shared URLs via intent handler * i18n: add global search and novel error strings Generated with omp (AI coding agent) * novel store: track bootstrap failures as user-facing errors Bootstrap failures no longer surface raw plugin/DB errors; missing novels map to a custom not-found message. Generated with omp (AI coding agent) * novel screen: render error view when bootstrap fails Shows a custom error with a back action instead of a blank screen, and hides the appbar actions in the error state. Generated with omp (AI coding agent) * global search: never auto-navigate or search URL text URLs are handled by the screen's explicit submit flow; navigation and search stay out of the hook. Generated with omp (AI coding agent) * global search: add animated open-novel FAB with clipboard offer Submit or FAB tap opens a matching URL's novel; unmatched URLs toast. The FAB floats above the keyboard via keyboard-controller and slides in from the right. Generated with omp (AI coding agent) * fix review issues * fix rebase issue
52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
const mockNavigate = jest.fn();
|
|
const mockSetOptions = jest.fn();
|
|
const mockNavigationRef = {
|
|
isReady: jest.fn(() => true),
|
|
navigate: mockNavigate,
|
|
getCurrentRoute: jest.fn(() => null),
|
|
};
|
|
|
|
// Patch react-native-worklets mock so reanimated setup doesn't crash.
|
|
// Reanimated v4.5.2 imports createShareable, UIRuntimeId, getUIRuntimeHolder,
|
|
// getUISchedulerHolder, toggleSlowAnimationsOnUIRuntime from worklets,
|
|
// but the shipped mock (src/mock.ts) doesn't export them.
|
|
jest.mock('react-native-worklets', () => {
|
|
const mockWorklets = jest.requireActual('react-native-worklets/src/mock');
|
|
return {
|
|
__esModule: true,
|
|
...mockWorklets,
|
|
getUIRuntimeHolder: () => ({}),
|
|
getUISchedulerHolder: () => ({}),
|
|
createShareable: (_hostRuntimeId, initial) => initial,
|
|
UIRuntimeId: 2,
|
|
toggleSlowAnimationsOnUIRuntime: _enabled => {},
|
|
};
|
|
});
|
|
|
|
// Include this line for mocking react-native-gesture-handler
|
|
require('react-native-gesture-handler/jestSetup');
|
|
|
|
// Include this section for mocking react-native-reanimated
|
|
try {
|
|
const { setUpTests } = require('react-native-reanimated');
|
|
setUpTests();
|
|
} catch (e) {
|
|
// swallow — reanimated setup may fail in some environments
|
|
}
|
|
|
|
jest.mock('@react-navigation/native', () => {
|
|
return {
|
|
useFocusEffect: jest.fn(),
|
|
useNavigation: () => ({
|
|
navigate: mockNavigate,
|
|
setOptions: mockSetOptions,
|
|
}),
|
|
useRoute: () => ({
|
|
params: {},
|
|
}),
|
|
createNavigationContainerRef: () => mockNavigationRef,
|
|
};
|
|
});
|
|
|
|
module.exports = { mockNavigate, mockSetOptions, mockNavigationRef };
|