@@ -86,6 +86,28 @@ export class MockRNIterableAPI {
8686 } ) ;
8787 }
8888
89+ static async getInboxMessages ( ) : Promise < IterableInAppMessage [ ] | undefined > {
90+ return await new Promise ( ( resolve ) => {
91+ // Filter messages that are marked for inbox
92+ const inboxMessages =
93+ MockRNIterableAPI . messages ?. filter ( ( msg ) => msg . saveToInbox ) || [ ] ;
94+ resolve ( inboxMessages ) ;
95+ } ) ;
96+ }
97+
98+ static async getHtmlInAppContentForMessage (
99+ messageId : string
100+ ) : Promise < unknown > {
101+ return await new Promise ( ( resolve ) => {
102+ // Mock HTML content for testing
103+ const mockHtmlContent = {
104+ edgeInsets : { top : 10 , left : 20 , bottom : 30 , right : 40 } ,
105+ html : `<div>Mock HTML content for message ${ messageId } </div>` ,
106+ } ;
107+ resolve ( mockHtmlContent ) ;
108+ } ) ;
109+ }
110+
89111 static setAutoDisplayPaused = jest . fn ( ) ;
90112
91113 static showMessage = jest . fn (
@@ -113,22 +135,12 @@ export class MockRNIterableAPI {
113135
114136 static updateSubscriptions = jest . fn ( ) ;
115137
116- static getInboxMessages = jest . fn (
117- async ( ) : Promise < IterableInAppMessage [ ] | undefined > => {
118- return await new Promise ( ( resolve ) => {
119- resolve ( MockRNIterableAPI . messages ) ;
120- } ) ;
121- }
122- ) ;
123-
124138 static startSession = jest . fn ( ) ;
125139
126140 static endSession = jest . fn ( ) ;
127141
128142 static updateVisibleRows = jest . fn ( ) ;
129143
130- static getHtmlInAppContentForMessage = jest . fn ( ) ;
131-
132144 // set messages function is to set the messages static property
133145 // this is for testing purposes only
134146 static setMessages ( messages : IterableInAppMessage [ ] ) : void {
0 commit comments