11import { NativeEventEmitter } from 'react-native' ;
22
33import { IterableLogger } from '../core' ;
4- import { IterableInAppManager } from '../inApp' ;
54
65import { MockRNIterableAPI } from '../__mocks__/MockRNIterableAPI' ;
76
@@ -202,10 +201,8 @@ describe('Iterable In App', () => {
202201
203202 // WHEN the simulated local queue is set to the in-app messages
204203 MockRNIterableAPI . setMessages ( messages ) ;
205- const inAppManager = new IterableInAppManager ( ) ;
206-
207- // THEN Iterable,inAppManager.getMessages returns the list of in-app messages
208- return await inAppManager . getMessages ( ) . then ( ( messagesObtained ) => {
204+ // THEN Iterable.inAppManager.getMessages returns the list of in-app messages
205+ return await Iterable . inAppManager ?. getMessages ( ) . then ( ( messagesObtained ) => {
209206 expect ( messagesObtained ) . toEqual ( messages ) ;
210207 } ) ;
211208 } ) ;
@@ -224,9 +221,8 @@ describe('Iterable In App', () => {
224221
225222 // WHEN the simulated clicked url is set to the clicked url
226223 MockRNIterableAPI . setClickedUrl ( clickedUrl ) ;
227- const inAppManager = new IterableInAppManager ( ) ;
228224 // THEN Iterable,inAppManager.showMessage returns the simulated clicked url
229- return await inAppManager . showMessage ( message , consume ) . then ( ( url ) => {
225+ return await Iterable . inAppManager ? .showMessage ( message , consume ) . then ( ( url ) => {
230226 expect ( url ) . toEqual ( clickedUrl ) ;
231227 } ) ;
232228 } ) ;
@@ -242,10 +238,9 @@ describe('Iterable In App', () => {
242238 const location : IterableInAppLocation = IterableInAppLocation . inApp ;
243239 const source : IterableInAppDeleteSource =
244240 IterableInAppDeleteSource . deleteButton ;
245- const inAppManager = new IterableInAppManager ( ) ;
246241
247242 // WHEN Iterable.inAppManager.removeMessage is called
248- inAppManager . removeMessage ( message , location , source ) ;
243+ Iterable . inAppManager ? .removeMessage ( message , location , source ) ;
249244
250245 // THEN corresponding method is called on MockIterableAPI with appropriate parameters
251246 expect ( MockRNIterableAPI . removeMessage ) . toBeCalledWith (
@@ -266,8 +261,7 @@ describe('Iterable In App', () => {
266261 const read : boolean = true ;
267262
268263 // WHEN Iterable.inAppManager.setReadForMessage is called
269- const inAppManager = new IterableInAppManager ( ) ;
270- inAppManager . setReadForMessage ( message , read ) ;
264+ Iterable . inAppManager ?. setReadForMessage ( message , read ) ;
271265
272266 // THEN corresponding method is called on MockRNIterableAPI with appropriate parameters
273267 expect ( MockRNIterableAPI . setReadForMessage ) . toBeCalledWith (
@@ -281,8 +275,7 @@ describe('Iterable In App', () => {
281275 const paused : boolean = true ;
282276
283277 // WHEN Iterable.inAppManager.setAutoDisplayPaused is called
284- const inAppManager = new IterableInAppManager ( ) ;
285- inAppManager . setAutoDisplayPaused ( paused ) ;
278+ Iterable . inAppManager ?. setAutoDisplayPaused ( paused ) ;
286279
287280 // THEN corresponding method is called on MockRNIterableAPI with appropriate parameters
288281 expect ( MockRNIterableAPI . setAutoDisplayPaused ) . toBeCalledWith ( paused ) ;
0 commit comments