@@ -16,21 +16,21 @@ export class MockRNIterableAPI {
1616 } ) ;
1717 }
1818
19- static setEmail ( email : string , authToken ?: string ) : void {
19+ static setEmail = jest . fn ( ( email : string , authToken ?: string ) : void => {
2020 MockRNIterableAPI . email = email ;
2121 MockRNIterableAPI . token = authToken ;
22- }
22+ } ) ;
2323
2424 static async getUserId ( ) : Promise < string | undefined > {
2525 return await new Promise ( ( resolve ) => {
2626 resolve ( MockRNIterableAPI . userId ) ;
2727 } ) ;
2828 }
2929
30- static setUserId ( userId : string , authToken ?: string ) : void {
30+ static setUserId = jest . fn ( ( userId : string , authToken ?: string ) : void => {
3131 MockRNIterableAPI . userId = userId ;
3232 MockRNIterableAPI . token = authToken ;
33- }
33+ } ) ;
3434
3535 static disableDeviceForCurrentUser = jest . fn ( ) ;
3636
@@ -62,9 +62,11 @@ export class MockRNIterableAPI {
6262 } ) ;
6363 }
6464
65- static setAttributionInfo ( attributionInfo ?: IterableAttributionInfo ) : void {
66- MockRNIterableAPI . attributionInfo = attributionInfo ;
67- }
65+ static setAttributionInfo = jest . fn (
66+ ( attributionInfo ?: IterableAttributionInfo ) : void => {
67+ MockRNIterableAPI . attributionInfo = attributionInfo ;
68+ }
69+ ) ;
6870
6971 static initializeWithApiKey = jest . fn ( ) . mockResolvedValue ( true ) ;
7072
@@ -86,14 +88,16 @@ export class MockRNIterableAPI {
8688
8789 static setAutoDisplayPaused = jest . fn ( ) ;
8890
89- static async showMessage (
90- _message : IterableInAppMessage ,
91- _consume : boolean
92- ) : Promise < string | undefined > {
93- return await new Promise ( ( resolve ) => {
94- resolve ( MockRNIterableAPI . clickedUrl ) ;
95- } ) ;
96- }
91+ static showMessage = jest . fn (
92+ async (
93+ _messageId : string ,
94+ _consume : boolean
95+ ) : Promise < string | undefined > => {
96+ return await new Promise ( ( resolve ) => {
97+ resolve ( MockRNIterableAPI . clickedUrl ) ;
98+ } ) ;
99+ }
100+ ) ;
97101
98102 static removeMessage = jest . fn ( ) ;
99103
@@ -109,6 +113,22 @@ export class MockRNIterableAPI {
109113
110114 static updateSubscriptions = jest . fn ( ) ;
111115
116+ static getInboxMessages = jest . fn (
117+ async ( ) : Promise < IterableInAppMessage [ ] | undefined > => {
118+ return await new Promise ( ( resolve ) => {
119+ resolve ( MockRNIterableAPI . messages ) ;
120+ } ) ;
121+ }
122+ ) ;
123+
124+ static startSession = jest . fn ( ) ;
125+
126+ static endSession = jest . fn ( ) ;
127+
128+ static updateVisibleRows = jest . fn ( ) ;
129+
130+ static getHtmlInAppContentForMessage = jest . fn ( ) ;
131+
112132 // set messages function is to set the messages static property
113133 // this is for testing purposes only
114134 static setMessages ( messages : IterableInAppMessage [ ] ) : void {
0 commit comments