forked from lnreader/lnreader
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.setup.js
More file actions
36 lines (32 loc) · 1.17 KB
/
Copy pathjest.setup.js
File metadata and controls
36 lines (32 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Mock all native modules and problematic ESM dependencies globally
// Mock react-native-device-info
jest.mock('react-native-device-info', () => ({
getDeviceUserAgentSync: jest.fn(() => 'Mozilla/5.0 (test)'),
getSystemName: jest.fn(() => 'iOS'),
getSystemVersion: jest.fn(() => '14.0'),
getVersion: jest.fn(() => '1.0.0'),
getBuildNumber: jest.fn(() => '1'),
getUniqueId: jest.fn(() => 'test-id'),
getDeviceId: jest.fn(() => 'test-device'),
}));
// Mock @react-navigation/native
jest.mock('@react-navigation/native', () => ({
useNavigation: jest.fn(() => ({
navigate: jest.fn(),
goBack: jest.fn(),
setOptions: jest.fn(),
})),
useFocusEffect: jest.fn(),
useRoute: jest.fn(() => ({ params: {} })),
useIsFocused: jest.fn(() => true),
}));
// Mock other native specs if needed
jest.mock('../specs/NativeFile', () => ({
__esModule: true,
default: {
getConstants: () => ({ ExternalDirectoryPath: '/mock/path' }),
},
}));
// Provide a light DevMenu TurboModule mock to satisfy react-native internals
// Note: Nightly/CI can mock required TurboModules in tests instead of globally.
// Keep global setup minimal to avoid masking native integration issues.