@@ -2,24 +2,21 @@ import { NativeEventEmitter } from 'react-native';
22
33import { MockLinking } from '../__mocks__/MockLinking' ;
44import { MockRNIterableAPI } from '../__mocks__/MockRNIterableAPI' ;
5- import { TestHelper } from './TestHelper' ;
6-
5+ import { IterableLogger } from '../core' ;
76// import from the same location that consumers import from
87import {
98 Iterable ,
109 IterableAction ,
1110 IterableActionContext ,
1211 IterableActionSource ,
13- IterableConfig ,
14- IterableLogLevel ,
15- } from '../index' ;
16- import {
17- EventName ,
1812 IterableAttributionInfo ,
1913 IterableCommerceItem ,
20- } from '../Iterable' ;
21- import { IterableDataRegion } from '../IterableDataRegion' ;
22- import { IterableLogger } from '../IterableLogger' ;
14+ IterableConfig ,
15+ IterableDataRegion ,
16+ IterableEventName ,
17+ IterableLogLevel ,
18+ } from '..' ;
19+ import { TestHelper } from './TestHelper' ;
2320
2421describe ( 'Iterable' , ( ) => {
2522 beforeEach ( ( ) => {
@@ -253,7 +250,7 @@ describe('Iterable', () => {
253250 ) ;
254251 // sets up event emitter
255252 const nativeEmitter = new NativeEventEmitter ( ) ;
256- nativeEmitter . removeAllListeners ( EventName . handleUrlCalled ) ;
253+ nativeEmitter . removeAllListeners ( IterableEventName . handleUrlCalled ) ;
257254 // sets up config file and urlHandler function
258255 // urlHandler set to return false
259256 const config = new IterableConfig ( ) ;
@@ -276,7 +273,7 @@ describe('Iterable', () => {
276273 context : { action : actionDict , source : 'inApp' } ,
277274 } ;
278275 // WHEN handleUrlCalled event is emitted
279- nativeEmitter . emit ( EventName . handleUrlCalled , dict ) ;
276+ nativeEmitter . emit ( IterableEventName . handleUrlCalled , dict ) ;
280277 // THEN urlHandler and MockLinking is called with expected url
281278 return await TestHelper . delayed ( 0 , ( ) => {
282279 expect ( config . urlHandler ) . toBeCalledWith ( expectedUrl , dict . context ) ;
@@ -289,7 +286,7 @@ describe('Iterable', () => {
289286 ) ;
290287 // sets up event emitter
291288 const nativeEmitter = new NativeEventEmitter ( ) ;
292- nativeEmitter . removeAllListeners ( EventName . handleUrlCalled ) ;
289+ nativeEmitter . removeAllListeners ( IterableEventName . handleUrlCalled ) ;
293290 // sets up config file and urlHandler function
294291 // urlHandler set to return false
295292 const config = new IterableConfig ( ) ;
@@ -312,7 +309,7 @@ describe('Iterable', () => {
312309 context : { action : actionDict , source : 'inApp' } ,
313310 } ;
314311 // WHEN handleUrlCalled event is emitted
315- nativeEmitter . emit ( EventName . handleUrlCalled , dict ) ;
312+ nativeEmitter . emit ( IterableEventName . handleUrlCalled , dict ) ;
316313 // THEN urlHandler is called and MockLinking.openURL is not called
317314 return await TestHelper . delayed ( 0 , ( ) => {
318315 expect ( config . urlHandler ) . toBeCalledWith ( expectedUrl , dict . context ) ;
@@ -325,7 +322,7 @@ describe('Iterable', () => {
325322 ) ;
326323 // sets up event emitter
327324 const nativeEmitter = new NativeEventEmitter ( ) ;
328- nativeEmitter . removeAllListeners ( EventName . handleUrlCalled ) ;
325+ nativeEmitter . removeAllListeners ( IterableEventName . handleUrlCalled ) ;
329326 // sets up config file and urlHandler function
330327 // urlHandler set to return true
331328 const config = new IterableConfig ( ) ;
@@ -348,7 +345,7 @@ describe('Iterable', () => {
348345 context : { action : actionDict , source : 'inApp' } ,
349346 } ;
350347 // WHEN handleUrlCalled event is emitted
351- nativeEmitter . emit ( EventName . handleUrlCalled , dict ) ;
348+ nativeEmitter . emit ( IterableEventName . handleUrlCalled , dict ) ;
352349 // THEN urlHandler is called and MockLinking.openURL is not called
353350 return await TestHelper . delayed ( 0 , ( ) => {
354351 expect ( config . urlHandler ) . toBeCalledWith ( expectedUrl , dict . context ) ;
@@ -361,7 +358,9 @@ describe('Iterable', () => {
361358 ) ;
362359 // sets up event emitter
363360 const nativeEmitter = new NativeEventEmitter ( ) ;
364- nativeEmitter . removeAllListeners ( EventName . handleCustomActionCalled ) ;
361+ nativeEmitter . removeAllListeners (
362+ IterableEventName . handleCustomActionCalled
363+ ) ;
365364 // sets up config file and customActionHandler function
366365 // customActionHandler set to return true
367366 const config = new IterableConfig ( ) ;
@@ -382,7 +381,7 @@ describe('Iterable', () => {
382381 context : { action : actionDict , source : IterableActionSource . inApp } ,
383382 } ;
384383 // WHEN handleCustomActionCalled event is emitted
385- nativeEmitter . emit ( EventName . handleCustomActionCalled , dict ) ;
384+ nativeEmitter . emit ( IterableEventName . handleCustomActionCalled , dict ) ;
386385 // THEN customActionHandler is called with expected action and expected context
387386 const expectedAction = new IterableAction ( actionName , actionData ) ;
388387 const expectedContext = new IterableActionContext (
0 commit comments