11import { jest } from '@jest/globals'
22import { URLChangeNavigationData } from '@segment/analytics-signals-runtime'
3- import { URLChangeObservableSettings } from '../../../../lib/detect-url-change'
43import { setLocation } from '../../../../test-helpers/set-location'
54import { SignalEmitter } from '../../../emitter'
65import { OnNavigationEventGenerator } from '../navigation-gen'
@@ -23,9 +22,7 @@ describe('OnNavigationEventGenerator', () => {
2322 } )
2423
2524 it ( 'should emit an event with action "pageLoad" on initialization' , ( ) => {
26- const settings : URLChangeObservableSettings = { pollInterval : 100 }
27- const generator = new OnNavigationEventGenerator ( settings )
28-
25+ const generator = new OnNavigationEventGenerator ( )
2926 generator . register ( emitter )
3027 expect ( emitSpy ) . toHaveBeenCalledTimes ( 1 )
3128 expect ( emitSpy . mock . lastCall ) . toMatchInlineSnapshot ( `
@@ -57,8 +54,7 @@ describe('OnNavigationEventGenerator', () => {
5754 } )
5855
5956 it ( 'should emit an event with "action: urlChange" when the URL changes' , ( ) => {
60- const settings : URLChangeObservableSettings = { pollInterval : 100 }
61- const generator = new OnNavigationEventGenerator ( settings )
57+ const generator = new OnNavigationEventGenerator ( )
6258
6359 generator . register ( emitter )
6460
@@ -75,7 +71,7 @@ describe('OnNavigationEventGenerator', () => {
7571 } )
7672
7773 // Advance the timers to trigger the polling
78- jest . advanceTimersByTime ( settings . pollInterval ! + 100 )
74+ jest . advanceTimersByTime ( 1000 )
7975
8076 expect ( emitSpy ) . toHaveBeenCalledTimes ( 2 )
8177
@@ -114,8 +110,7 @@ describe('OnNavigationEventGenerator', () => {
114110 } )
115111
116112 it ( 'should only list the property that actually changed in changedProperties, and no more/less' , ( ) => {
117- const settings : URLChangeObservableSettings = { pollInterval : 100 }
118- const generator = new OnNavigationEventGenerator ( settings )
113+ const generator = new OnNavigationEventGenerator ( )
119114
120115 generator . register ( emitter )
121116
@@ -126,7 +121,7 @@ describe('OnNavigationEventGenerator', () => {
126121 hash : newUrl . hash ,
127122 } )
128123
129- jest . advanceTimersByTime ( settings . pollInterval ! + 1000 )
124+ jest . advanceTimersByTime ( 1000 )
130125 const lastCall = emitSpy . mock . lastCall ! [ 0 ] . data as URLChangeNavigationData
131126 expect ( lastCall . changedProperties ) . toEqual ( [ 'hash' ] )
132127 } )
0 commit comments