Files
lnreader/__mocks__/nativeModules.js
T
Patrick Loser c3c891cea0 refactor: Migrate to Expo Managed Workflow (#1885)
* enable predictive back gesture

* upgrade to rn 85

* remove deprecated

* added timeout to theme switch

* fix plugin items hit registration

* fix SearchbarV2 hit registration

* fix loading spinner

* migrated to expo

* migrated to expo

* Fix reader footer animation

* working again

* added icons back

* added splashscreen

* clean up

* nitro epub

* fix

* remove .env.local from git tracking

* fix rn background actions not working

* moving custom permissions to app.json

* more cleanup

* fix epub import

* remove unused deps

* Further cleanup for gradle build types

* Update build.yml

* ignore android/ and ios/ as they are generated by CNG

* fix lint

* Delete ios directory

* Delete android directory

* fix lint

* fix test mocks

* update packages

* update eslint

* fix ThemeProvider placement

* fix test and lint

* Add BackgroundTask native module

* Add NativeFile changes

* first round of fixing compatibility issues

* added types for native modules
2026-07-22 23:29:53 +05:30

72 lines
1.7 KiB
JavaScript

// require('react-native-gesture-handler/jestSetup');
// require('react-native-reanimated').setUpTests();
jest.mock('@modules/native-file', () => ({
__esModule: true,
default: {
writeFile: jest.fn(),
readFile: jest.fn(() => ''),
copyFile: jest.fn(),
moveFile: jest.fn(),
exists: jest.fn(() => true),
mkdir: jest.fn(),
unlink: jest.fn(),
readDir: jest.fn(() => []),
downloadFile: jest.fn().mockResolvedValue(),
getConstants: jest.fn(() => ({
ExternalDirectoryPath: '/mock/external',
ExternalCachesDirectoryPath: '/mock/caches',
})),
},
}));
const mockEpubNovel = {
name: 'Mock Novel',
cover: null,
summary: null,
author: null,
artist: null,
chapters: [],
cssPaths: [],
imagePaths: [],
};
jest.mock('react-native-nitro-modules', () => ({
NitroModules: {
createHybridObject: jest.fn(() => ({
parseNovelAndChapters: jest.fn(() => mockEpubNovel),
})),
},
}));
jest.mock('@modules/native-tts-media-control', () => ({
__esModule: true,
default: {
showMediaNotification: jest.fn(),
updatePlaybackState: jest.fn(),
updateProgress: jest.fn(),
dismiss: jest.fn(),
addListener: jest.fn(),
removeListeners: jest.fn(),
},
}));
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(''),
},
}));