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
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
// require('react-native-gesture-handler/jestSetup');
|
|
// require('react-native-reanimated').setUpTests();
|
|
|
|
jest.mock('@modules/native-file', () => ({
|
|
__esModule: true,
|
|
default: {
|
|
DocumentDirectoryPath: '/mock/documents',
|
|
ExternalDirectoryPath: '/mock/external',
|
|
ExternalCachesDirectoryPath: '/mock/caches',
|
|
writeFile: jest.fn(),
|
|
readFile: jest.fn(() => ''),
|
|
copyFile: jest.fn(),
|
|
copyFileToDirectory: jest.fn(() =>
|
|
Promise.resolve({ uri: '/mock/export.epub', size: 1 }),
|
|
),
|
|
pickDirectory: jest.fn(() =>
|
|
Promise.resolve({ uri: '/mock/export', name: 'export' }),
|
|
),
|
|
moveFile: jest.fn(),
|
|
exists: jest.fn(() => true),
|
|
mkdir: jest.fn(),
|
|
unlink: jest.fn(),
|
|
readDir: jest.fn(() => []),
|
|
downloadFile: jest.fn().mockResolvedValue(),
|
|
},
|
|
}));
|
|
|
|
const mockEpubNovel = {
|
|
name: 'Mock Novel',
|
|
cover: null,
|
|
summary: null,
|
|
author: null,
|
|
artist: null,
|
|
chapters: [],
|
|
cssPaths: [],
|
|
imagePaths: [],
|
|
};
|
|
|
|
global.mockEpubNovel = mockEpubNovel;
|
|
|
|
jest.mock('@modules/native-volume-button-listener', () => ({
|
|
__esModule: true,
|
|
default: {
|
|
addListener: jest.fn(() => ({ remove: jest.fn() })),
|
|
removeListeners: jest.fn(),
|
|
setActive: jest.fn(),
|
|
},
|
|
}));
|
|
|
|
jest.mock('@modules/native-share-receiver', () => ({
|
|
__esModule: true,
|
|
default: {
|
|
getInitialSharedText: jest.fn(async () => null),
|
|
addListener: jest.fn(() => ({ remove: jest.fn() })),
|
|
removeListeners: jest.fn(),
|
|
},
|
|
}));
|
|
|
|
jest.mock('@modules/native-zip-archive', () => ({
|
|
__esModule: true,
|
|
default: {
|
|
zip: jest.fn().mockResolvedValue(),
|
|
unzip: jest.fn().mockResolvedValue(),
|
|
remoteUnzip: jest.fn().mockResolvedValue(),
|
|
remoteZip: jest.fn().mockResolvedValue(''),
|
|
},
|
|
}));
|