@@ -360,22 +360,30 @@ describe('Sorted State Adapter', () => {
360
360
const withInitialItems = sortedItemsAdapter . setAll (
361
361
sortedItemsAdapter . getInitialState ( ) ,
362
362
[
363
+ { id : 'C' , order : 3 , ts : 0 } ,
363
364
{ id : 'A' , order : 1 , ts : 0 } ,
365
+ { id : 'F' , order : 4 , ts : 0 } ,
364
366
{ id : 'B' , order : 2 , ts : 0 } ,
365
- { id : 'C' , order : 3 , ts : 0 } ,
366
367
{ id : 'D' , order : 3 , ts : 0 } ,
367
368
{ id : 'E' , order : 3 , ts : 0 } ,
368
369
] ,
369
370
)
370
371
371
- expect ( withInitialItems . ids ) . toEqual ( [ 'A' , 'B' , 'C' , 'D' , 'E' ] )
372
+ expect ( withInitialItems . ids ) . toEqual ( [ 'A' , 'B' , 'C' , 'D' , 'E' , 'F' ] )
372
373
373
374
const updated = sortedItemsAdapter . updateOne ( withInitialItems , {
374
375
id : 'C' ,
375
376
changes : { ts : 5 } ,
376
377
} )
377
378
378
- expect ( updated . ids ) . toEqual ( [ 'A' , 'B' , 'C' , 'D' , 'E' ] )
379
+ expect ( updated . ids ) . toEqual ( [ 'A' , 'B' , 'C' , 'D' , 'E' , 'F' ] )
380
+
381
+ const updated2 = sortedItemsAdapter . updateOne ( withInitialItems , {
382
+ id : 'D' ,
383
+ changes : { ts : 6 } ,
384
+ } )
385
+
386
+ expect ( updated2 . ids ) . toEqual ( [ 'A' , 'B' , 'C' , 'D' , 'E' , 'F' ] )
379
387
} )
380
388
381
389
it ( 'should let you update many entities by id in the state' , ( ) => {
0 commit comments