-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
jest.setup.ts
52 lines (50 loc) · 1.4 KB
/
jest.setup.ts
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
48
49
50
51
52
import * as ReactNative from 'react-native';
jest.doMock('react-native', () => {
return Object.setPrototypeOf(
{
NativeModules: {
...ReactNative.NativeModules,
RNAppModule: {
addListener: jest.fn(),
removeListeners: jest.fn(),
eventsAddListener: jest.fn(),
eventsNotifyReady: jest.fn(),
},
RNGoogleMobileAdsModule: {
addListener: jest.fn(),
removeListeners: jest.fn(),
eventsAddListener: jest.fn(),
eventsNotifyReady: jest.fn(),
},
RNGoogleMobileAdsRewardedModule: {},
RNGoogleMobileAdsConsentModule: {},
},
TurboModuleRegistry: {
...ReactNative.TurboModuleRegistry,
getEnforcing: moduleName => {
if (moduleName === 'RNGoogleMobileAdsInterstitialModule') {
return {
interstitialLoad: jest.fn(),
};
}
return {
initialize: jest.fn(),
setRequestConfiguration: jest.fn(),
openAdInspector: jest.fn(),
openDebugMenu: jest.fn(),
setAppVolume: jest.fn(),
setAppMuted: jest.fn(),
};
},
},
},
ReactNative,
);
});
jest.doMock('./src/specs/components/GoogleMobileAdsBannerViewNativeComponent', () => {
return {
__esModule: true,
Commands: {},
default: ReactNative.View,
};
});