-
-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathjest.setup.ts
More file actions
92 lines (90 loc) · 2.46 KB
/
jest.setup.ts
File metadata and controls
92 lines (90 loc) · 2.46 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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,
};
});
jest.doMock('./src/specs/components/GoogleMobileAdsNativeViewNativeComponent', () => {
return {
__esModule: true,
Commands: {},
default: ReactNative.View,
};
});
jest.doMock('./src/specs/modules/NativeInterstitialModule', () => {
return {
__esModule: true,
Commands: {},
default: {
interstitialLoad: jest.fn(),
interstitialShow: jest.fn(),
},
};
});
jest.doMock('./src/specs/modules/NativeAppModule', () => {
return {
__esModule: true,
default: {
addListener: jest.fn(),
removeListeners: jest.fn(),
eventsAddListener: jest.fn(),
eventsRemoveListener: jest.fn(),
eventsNotifyReady: jest.fn(),
initializeApp: jest.fn(),
setAutomaticDataCollectionEnabled: jest.fn(),
deleteApp: jest.fn(),
eventsGetListeners: jest.fn(),
eventsPing: jest.fn(),
metaGetAll: jest.fn(),
jsonGetAll: jest.fn(),
preferencesSetBool: jest.fn(),
preferencesSetString: jest.fn(),
preferencesGetAll: jest.fn(),
preferencesClearAll: jest.fn(),
},
};
});