1- jest . mock ( 'NativeModules' , ( ) => {
2- return {
3- Instabug : {
4- startWithToken : jest . fn ( ) ,
5- setUserData : jest . fn ( ) ,
6- setTrackUserSteps : jest . fn ( ) ,
7- setIBGLogPrintsToConsole : jest . fn ( ) ,
8- didSelectPromptOptionHandler : jest . fn ( ) ,
9- setSessionProfilerEnabled : jest . fn ( ) ,
10- setPushNotificationsEnabled : jest . fn ( ) ,
11- setLocale : jest . fn ( ) ,
12- setColorTheme : jest . fn ( ) ,
13- setPrimaryColor : jest . fn ( ) ,
14- appendTags : jest . fn ( ) ,
15- resetTags : jest . fn ( ) ,
16- getTags : jest . fn ( cb => cb ( [ 'tags1' , 'tags2' ] ) ) ,
17- setString : jest . fn ( ) ,
18- identifyUserWithEmail : jest . fn ( ) ,
19- logOut : jest . fn ( ) ,
20- logUserEventWithName : jest . fn ( ) ,
21- log : jest . fn ( ) ,
22- logVerbose : jest . fn ( ) ,
23- logInfo : jest . fn ( ) ,
24- logWarn : jest . fn ( ) ,
25- logError : jest . fn ( ) ,
26- logDebug : jest . fn ( ) ,
27- clearLogs : jest . fn ( ) ,
28- setReproStepsMode : jest . fn ( ) ,
29- setSdkDebugLogsLevel : jest . fn ( ) ,
30- setUserAttribute : jest . fn ( ) ,
31- getUserAttribute : jest . fn ( ( _ , cb ) => cb ( '24' ) ) ,
32- removeUserAttribute : jest . fn ( ) ,
33- getAllUserAttributes : jest . fn ( cb => cb ( [ { age : '24' } ] ) ) ,
34- clearAllUserAttributes : jest . fn ( ) ,
35- setDebugEnabled : jest . fn ( ) ,
36- enable : jest . fn ( ) ,
37- disable : jest . fn ( ) ,
38- isRunningLive : jest . fn ( cb => cb ( true ) ) ,
39- setVideoRecordingFloatingButtonPosition : jest . fn ( ) ,
40- showWelcomeMessageWithMode : jest . fn ( ) ,
41- setWelcomeMessageMode : jest . fn ( ) ,
42- setFileAttachment : jest . fn ( ) ,
43- hideView : jest . fn ( ) ,
44- show : jest . fn ( ) ,
45- setPreSendingHandler : jest . fn ( ) ,
46- callPrivateApi : jest . fn ( ) ,
47- addListener : jest . fn ( ) ,
48- getReport : jest . fn ( ) ,
49- sendHandledJSCrash : jest . fn ( ) ,
50- sendJSCrash : jest . fn ( ) ,
51- reportScreenChange : jest . fn ( ) ,
52- } ,
53- IBGBugReporting : {
54- setFloatingButtonEdge : jest . fn ( ) ,
55- setEnabledAttachmentTypes : jest . fn ( ) ,
56- } ,
57- IBGReplies : {
58- setPushNotificationsEnabled : jest . fn ( ) ,
59- } ,
60- } ;
61- } ) ;
1+ jest . mock ( "react-native" , ( ) => {
2+ const RN = jest . requireActual ( "react-native" ) ; // use original implementation, which comes with mocks out of the box
3+ RN . NativeModules . Instabug = {
4+ startWithToken : jest . fn ( ) ,
5+ setUserData : jest . fn ( ) ,
6+ setTrackUserSteps : jest . fn ( ) ,
7+ setIBGLogPrintsToConsole : jest . fn ( ) ,
8+ didSelectPromptOptionHandler : jest . fn ( ) ,
9+ setSessionProfilerEnabled : jest . fn ( ) ,
10+ setPushNotificationsEnabled : jest . fn ( ) ,
11+ setLocale : jest . fn ( ) ,
12+ setColorTheme : jest . fn ( ) ,
13+ setPrimaryColor : jest . fn ( ) ,
14+ appendTags : jest . fn ( ) ,
15+ resetTags : jest . fn ( ) ,
16+ getTags : jest . fn ( ( cb ) => cb ( [ "tags1" , "tags2" ] ) ) ,
17+ setString : jest . fn ( ) ,
18+ identifyUserWithEmail : jest . fn ( ) ,
19+ logOut : jest . fn ( ) ,
20+ logUserEventWithName : jest . fn ( ) ,
21+ log : jest . fn ( ) ,
22+ logVerbose : jest . fn ( ) ,
23+ logInfo : jest . fn ( ) ,
24+ logWarn : jest . fn ( ) ,
25+ logError : jest . fn ( ) ,
26+ logDebug : jest . fn ( ) ,
27+ clearLogs : jest . fn ( ) ,
28+ setReproStepsMode : jest . fn ( ) ,
29+ setSdkDebugLogsLevel : jest . fn ( ) ,
30+ setUserAttribute : jest . fn ( ) ,
31+ getUserAttribute : jest . fn ( ( _ , cb ) => cb ( "24" ) ) ,
32+ removeUserAttribute : jest . fn ( ) ,
33+ getAllUserAttributes : jest . fn ( ( cb ) => cb ( [ { age : "24" } ] ) ) ,
34+ clearAllUserAttributes : jest . fn ( ) ,
35+ setDebugEnabled : jest . fn ( ) ,
36+ enable : jest . fn ( ) ,
37+ disable : jest . fn ( ) ,
38+ isRunningLive : jest . fn ( ( cb ) => cb ( true ) ) ,
39+ setVideoRecordingFloatingButtonPosition : jest . fn ( ) ,
40+ showWelcomeMessageWithMode : jest . fn ( ) ,
41+ setWelcomeMessageMode : jest . fn ( ) ,
42+ setFileAttachment : jest . fn ( ) ,
43+ hideView : jest . fn ( ) ,
44+ show : jest . fn ( ) ,
45+ setPreSendingHandler : jest . fn ( ) ,
46+ callPrivateApi : jest . fn ( ) ,
47+ addListener : jest . fn ( ) ,
48+ getReport : jest . fn ( ) ,
49+ sendHandledJSCrash : jest . fn ( ) ,
50+ sendJSCrash : jest . fn ( ) ,
51+ reportScreenChange : jest . fn ( ) ,
52+ } ;
53+ RN . NativeModules . IBGBugReporting = {
54+ setFloatingButtonEdge : jest . fn ( ) ,
55+ setEnabledAttachmentTypes : jest . fn ( ) ,
56+ } ;
57+ RN . NativeModules . IBGReplies = {
58+ setPushNotificationsEnabled : jest . fn ( ) ,
59+ } ;
60+
61+ return RN ;
62+ } ) ;
0 commit comments