@@ -85,7 +85,7 @@ describe('PollingController', () => {
85
85
} ) ;
86
86
87
87
describe ( 'setIntervalLength' , ( ) => {
88
- it ( 'should set getNetworkClientById if previously set to undefined when setting interval length' , async ( ) => {
88
+ it ( 'should set getNetworkClientById ( if previously set by setPollWithBlockTracker) to undefined when setting interval length' , async ( ) => {
89
89
controller . setPollWithBlockTracker ( ( ) => {
90
90
throw new Error ( 'should not be called' ) ;
91
91
} ) ;
@@ -136,6 +136,7 @@ describe('PollingController', () => {
136
136
expect ( controller . _executePoll ) . toHaveBeenCalledTimes ( 2 ) ;
137
137
} ) ;
138
138
it ( 'should start and stop polling sessions for different networkClientIds with the same options' , async ( ) => {
139
+ controller . setIntervalLength ( TICK_TIME ) ;
139
140
const pollToken1 = controller . startPollingByNetworkClientId ( 'mainnet' , {
140
141
address : '0x1' ,
141
142
} ) ;
@@ -180,30 +181,30 @@ describe('PollingController', () => {
180
181
controller . startPollingByNetworkClientId ( 'mainnet' ) ;
181
182
await advanceTime ( { clock, duration : 0 } ) ;
182
183
183
- controller . startPollingByNetworkClientId ( 'goerli ' ) ;
184
+ controller . startPollingByNetworkClientId ( 'rinkeby ' ) ;
184
185
await advanceTime ( { clock, duration : 0 } ) ;
185
186
186
187
expect ( controller . _executePoll . mock . calls ) . toMatchObject ( [
187
188
[ 'mainnet' , { } ] ,
188
- [ 'goerli ' , { } ] ,
189
+ [ 'rinkeby ' , { } ] ,
189
190
] ) ;
190
191
await advanceTime ( { clock, duration : TICK_TIME } ) ;
191
192
192
193
expect ( controller . _executePoll . mock . calls ) . toMatchObject ( [
193
194
[ 'mainnet' , { } ] ,
194
- [ 'goerli ' , { } ] ,
195
+ [ 'rinkeby ' , { } ] ,
195
196
[ 'mainnet' , { } ] ,
196
- [ 'goerli ' , { } ] ,
197
+ [ 'rinkeby ' , { } ] ,
197
198
] ) ;
198
199
await advanceTime ( { clock, duration : TICK_TIME } ) ;
199
200
200
201
expect ( controller . _executePoll . mock . calls ) . toMatchObject ( [
201
202
[ 'mainnet' , { } ] ,
202
- [ 'goerli ' , { } ] ,
203
+ [ 'rinkeby ' , { } ] ,
203
204
[ 'mainnet' , { } ] ,
204
- [ 'goerli ' , { } ] ,
205
+ [ 'rinkeby ' , { } ] ,
205
206
[ 'mainnet' , { } ] ,
206
- [ 'goerli ' , { } ] ,
207
+ [ 'rinkeby ' , { } ] ,
207
208
] ) ;
208
209
controller . stopAllPolling ( ) ;
209
210
} ) ;
@@ -327,10 +328,10 @@ describe('PollingController', () => {
327
328
} ) ;
328
329
} ) ;
329
330
330
- it ( 'should set the interval length to 0 ' , ( ) => {
331
+ it ( 'should set the interval length to undefined ' , ( ) => {
331
332
controller . setPollWithBlockTracker ( getNetworkClientById ) ;
332
333
333
- expect ( controller . getIntervalLength ( ) ) . toBe ( 0 ) ;
334
+ expect ( controller . getIntervalLength ( ) ) . toBeUndefined ( ) ;
334
335
} ) ;
335
336
336
337
it ( 'should start polling for the specified networkClientId' , async ( ) => {
@@ -368,7 +369,6 @@ describe('PollingController', () => {
368
369
expect ( controller . _executePoll ) . toHaveBeenCalledTimes ( 1 ) ;
369
370
expect ( controller . _executePoll ) . toHaveBeenCalledWith ( 'mainnet' , { } , 1 ) ;
370
371
371
- // Start polling for goerli, 10ms interval
372
372
await advanceTime ( { clock, duration : 5 } ) ;
373
373
374
374
expect ( controller . _executePoll . mock . calls ) . toMatchObject ( [
@@ -450,11 +450,9 @@ describe('PollingController', () => {
450
450
[ 'mainnet' , { } , 2 ] ,
451
451
[ 'mainnet' , { } , 3 ] ,
452
452
] ) ;
453
-
454
- controller . stopAllPolling ( ) ;
455
453
} ) ;
456
454
457
- it ( 'should should stop polling when all polling tokens for a networkClientId are deleted, even if other networkClientIds are still polling ' , async ( ) => {
455
+ it ( 'should should stop polling for one networkClientId when all polling tokens for that networkClientId are deleted, without stopping polling for networkClientIds with active pollingTokens ' , async ( ) => {
458
456
controller . setPollWithBlockTracker ( getNetworkClientById ) ;
459
457
460
458
const pollingToken1 =
0 commit comments