59 lines
1.5 KiB
JavaScript
59 lines
1.5 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-zip-archive', () => ({
|
|
__esModule: true,
|
|
default: {
|
|
zip: jest.fn().mockResolvedValue(),
|
|
unzip: jest.fn().mockResolvedValue(),
|
|
remoteUnzip: jest.fn().mockResolvedValue(),
|
|
remoteZip: jest.fn().mockResolvedValue(''),
|
|
},
|
|
}));
|