11import { NativeEventEmitter } from 'react-native' ;
22
33import { IterableLogger } from '../core' ;
4+ import { IterableInAppManager } from '../inApp' ;
5+
46import { MockRNIterableAPI } from '../__mocks__/MockRNIterableAPI' ;
57
68import {
@@ -200,13 +202,12 @@ describe('Iterable In App', () => {
200202
201203 // WHEN the simulated local queue is set to the in-app messages
202204 MockRNIterableAPI . setMessages ( messages ) ;
205+ const inAppManager = new IterableInAppManager ( ) ;
203206
204207 // THEN Iterable,inAppManager.getMessages returns the list of in-app messages
205- return await Iterable . inAppManager
206- . getMessages ( )
207- . then ( ( messagesObtained ) => {
208- expect ( messagesObtained ) . toEqual ( messages ) ;
209- } ) ;
208+ return await inAppManager . getMessages ( ) . then ( ( messagesObtained ) => {
209+ expect ( messagesObtained ) . toEqual ( messages ) ;
210+ } ) ;
210211 } ) ;
211212
212213 test ( 'showMessage_messageAndConsume_returnsClickedUrl' , async ( ) => {
@@ -223,13 +224,11 @@ describe('Iterable In App', () => {
223224
224225 // WHEN the simulated clicked url is set to the clicked url
225226 MockRNIterableAPI . setClickedUrl ( clickedUrl ) ;
226-
227+ const inAppManager = new IterableInAppManager ( ) ;
227228 // THEN Iterable,inAppManager.showMessage returns the simulated clicked url
228- return await Iterable . inAppManager
229- . showMessage ( message , consume )
230- . then ( ( url ) => {
231- expect ( url ) . toEqual ( clickedUrl ) ;
232- } ) ;
229+ return await inAppManager . showMessage ( message , consume ) . then ( ( url ) => {
230+ expect ( url ) . toEqual ( clickedUrl ) ;
231+ } ) ;
233232 } ) ;
234233
235234 test ( 'removeMessage_params_methodCalledWithParams' , ( ) => {
@@ -243,9 +242,10 @@ describe('Iterable In App', () => {
243242 const location : IterableInAppLocation = IterableInAppLocation . inApp ;
244243 const source : IterableInAppDeleteSource =
245244 IterableInAppDeleteSource . deleteButton ;
245+ const inAppManager = new IterableInAppManager ( ) ;
246246
247247 // WHEN Iterable.inAppManager.removeMessage is called
248- Iterable . inAppManager . removeMessage ( message , location , source ) ;
248+ inAppManager . removeMessage ( message , location , source ) ;
249249
250250 // THEN corresponding method is called on MockIterableAPI with appropriate parameters
251251 expect ( MockRNIterableAPI . removeMessage ) . toBeCalledWith (
@@ -266,7 +266,8 @@ describe('Iterable In App', () => {
266266 const read : boolean = true ;
267267
268268 // WHEN Iterable.inAppManager.setReadForMessage is called
269- Iterable . inAppManager . setReadForMessage ( message , read ) ;
269+ const inAppManager = new IterableInAppManager ( ) ;
270+ inAppManager . setReadForMessage ( message , read ) ;
270271
271272 // THEN corresponding method is called on MockRNIterableAPI with appropriate parameters
272273 expect ( MockRNIterableAPI . setReadForMessage ) . toBeCalledWith (
@@ -280,7 +281,8 @@ describe('Iterable In App', () => {
280281 const paused : boolean = true ;
281282
282283 // WHEN Iterable.inAppManager.setAutoDisplayPaused is called
283- Iterable . inAppManager . setAutoDisplayPaused ( paused ) ;
284+ const inAppManager = new IterableInAppManager ( ) ;
285+ inAppManager . setAutoDisplayPaused ( paused ) ;
284286
285287 // THEN corresponding method is called on MockRNIterableAPI with appropriate parameters
286288 expect ( MockRNIterableAPI . setAutoDisplayPaused ) . toBeCalledWith ( paused ) ;
0 commit comments