-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.test.js
47 lines (43 loc) · 1.02 KB
/
setup.test.js
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
37
38
39
40
41
42
43
44
45
46
47
import { NativeModules } from 'react-native';
NativeModules.ConnectReactNativeSdk = {
checklink: jest.fn(),
};
jest.mock('react-native/Libraries/TurboModule/TurboModuleRegistry', () => {
const turboModuleRegistry = jest.requireActual(
'react-native/Libraries/TurboModule/TurboModuleRegistry'
);
return {
...turboModuleRegistry,
getEnforcing: (name) => {
if (name === 'RNCWebView') {
return null;
}
return turboModuleRegistry.getEnforcing(name);
},
};
});
jest.mock('./src/nativeModule', () => {
return {
checkLink: jest.fn().mockResolvedValue(false),
ConnectReactNativeSdk: {
close: jest.fn(),
open: jest.fn().mockResolvedValue({
type: 'close',
}),
},
};
});
jest.mock('react-native-inappbrowser-reborn', () => {
const InAppBrowser = {
open: jest.fn().mockResolvedValue({
type: 'close',
}),
close: jest.fn(),
openAuth: jest.fn(),
closeAuth: jest.fn(),
isAvailable: jest.fn(),
};
return {
InAppBrowser,
};
});