@@ -359,18 +359,20 @@ module.exports = function createTests(createHistory, name, reset = defaultReset)
359
359
it ( 'updates the router even if path is the same' , ( ) => {
360
360
const updates = [ ]
361
361
const historyUnsubscribe = history . listen ( location => {
362
- updates . push ( location . pathname ) ;
362
+ updates . push ( location . pathname )
363
363
} )
364
364
365
365
store . dispatch ( pushPath ( '/foo' ) )
366
366
store . dispatch ( pushPath ( '/foo' ) )
367
367
store . dispatch ( replacePath ( '/foo' ) )
368
368
369
- expect ( updates ) . toEqual ( [ '/' , '/foo' , '/foo' , '/foo' ] ) ;
369
+ expect ( updates ) . toEqual ( [ '/' , '/foo' , '/foo' , '/foo' ] )
370
+
371
+ historyUnsubscribe ( )
370
372
} )
371
373
372
374
it ( 'does not update the router for other state changes' , ( ) => {
373
- const state = store . getState ( ) ;
375
+ const state = store . getState ( )
374
376
375
377
store . dispatch ( {
376
378
type : 'RANDOM_ACTION' ,
@@ -381,7 +383,7 @@ module.exports = function createTests(createHistory, name, reset = defaultReset)
381
383
}
382
384
} )
383
385
384
- expect ( state ) . toEqual ( store . getState ( ) ) ;
386
+ expect ( state ) . toEqual ( store . getState ( ) )
385
387
} )
386
388
387
389
it ( 'only updates the router once when dispatching from `listenBefore`' , ( ) => {
@@ -397,14 +399,14 @@ module.exports = function createTests(createHistory, name, reset = defaultReset)
397
399
} )
398
400
} )
399
401
400
- const updates = [ ] ;
402
+ const updates = [ ]
401
403
history . listen ( location => {
402
- updates . push ( location . pathname ) ;
403
- } ) ;
404
+ updates . push ( location . pathname )
405
+ } )
404
406
405
407
store . dispatch ( pushPath ( '/foo' ) )
406
408
407
- expect ( updates ) . toEqual ( [ '/' , '/foo' ] )
409
+ expect ( updates ) . toEqual ( [ '/' , '/foo' ] )
408
410
} )
409
411
410
412
it ( 'allows updating the route from within `listenBefore`' , ( ) => {
@@ -417,10 +419,10 @@ module.exports = function createTests(createHistory, name, reset = defaultReset)
417
419
}
418
420
} )
419
421
420
- const updates = [ ] ;
422
+ const updates = [ ]
421
423
history . listen ( location => {
422
- updates . push ( location . pathname ) ;
423
- } ) ;
424
+ updates . push ( location . pathname )
425
+ } )
424
426
425
427
store . dispatch ( pushPath ( '/foo' ) )
426
428
expect ( store ) . toContainRoute ( {
@@ -434,7 +436,7 @@ module.exports = function createTests(createHistory, name, reset = defaultReset)
434
436
replace : true
435
437
} )
436
438
437
- expect ( updates ) . toEqual ( [ '/' , '/bar' , '/baz' ] ) ;
439
+ expect ( updates ) . toEqual ( [ '/' , '/bar' , '/baz' ] )
438
440
} )
439
441
440
442
it ( 'throws if "routing" key is missing with default selectRouteState' , ( ) => {
@@ -492,26 +494,26 @@ module.exports = function createTests(createHistory, name, reset = defaultReset)
492
494
it ( 'only triggers history once when updating path via store' , ( ) => {
493
495
const updates = [ ]
494
496
const historyUnsubscribe = history . listen ( location => {
495
- updates . push ( location . pathname ) ;
497
+ updates . push ( location . pathname )
496
498
} )
497
499
498
- store . dispatch ( pushPath ( '/bar' ) ) ;
499
- store . dispatch ( pushPath ( '/baz' ) ) ;
500
- expect ( updates ) . toEqual ( [ '/' , '/bar' , '/baz' ] )
500
+ store . dispatch ( pushPath ( '/bar' ) )
501
+ store . dispatch ( pushPath ( '/baz' ) )
502
+ expect ( updates ) . toEqual ( [ '/' , '/bar' , '/baz' ] )
501
503
502
504
historyUnsubscribe ( )
503
505
} )
504
506
505
507
it ( 'only triggers store once when updating path via store' , ( ) => {
506
508
const updates = [ ]
507
509
const storeUnsubscribe = store . subscribe ( ( ) => {
508
- updates . push ( store . getState ( ) . routing . path ) ;
510
+ updates . push ( store . getState ( ) . routing . path )
509
511
} )
510
512
511
- store . dispatch ( pushPath ( '/bar' ) ) ;
512
- store . dispatch ( pushPath ( '/baz' ) ) ;
513
- store . dispatch ( replacePath ( '/foo' ) ) ;
514
- expect ( updates ) . toEqual ( [ '/bar' , '/baz' , '/foo' ] )
513
+ store . dispatch ( pushPath ( '/bar' ) )
514
+ store . dispatch ( pushPath ( '/baz' ) )
515
+ store . dispatch ( replacePath ( '/foo' ) )
516
+ expect ( updates ) . toEqual ( [ '/bar' , '/baz' , '/foo' ] )
515
517
516
518
storeUnsubscribe ( )
517
519
} )
@@ -529,7 +531,7 @@ module.exports = function createTests(createHistory, name, reset = defaultReset)
529
531
path : '/bar'
530
532
} )
531
533
532
- history . pushState ( undefined , '/baz' ) ;
534
+ history . pushState ( undefined , '/baz' )
533
535
expect ( store ) . toContainRoute ( {
534
536
path : '/baz'
535
537
} )
0 commit comments