@@ -398,32 +398,31 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
398
398
DbMutationQueue
399
399
> ( DbMutationQueue . store ) ;
400
400
// Manually populate the mutation queue and create all indicies.
401
- let p = PersistencePromise . resolve ( ) ;
402
- for ( const testMutation of testMutations ) {
403
- p = p . next ( ( ) => mutationBatchStore . put ( testMutation ) ) ;
404
- for ( const write of testMutation . mutations ) {
405
- p = p . next ( ( ) => {
406
- const indexKey = DbDocumentMutation . key (
407
- testMutation . userId ,
408
- path ( write . update . name , 5 ) ,
409
- testMutation . batchId
410
- ) ;
411
- return documentMutationStore . put (
412
- indexKey ,
413
- DbDocumentMutation . PLACEHOLDER
414
- ) ;
415
- } ) ;
416
- }
417
- }
418
- p = p . next ( ( ) =>
401
+ return PersistencePromise . forEach ( testMutations , testMutation => {
402
+ return mutationBatchStore . put ( testMutation ) . next ( ( ) => {
403
+ return PersistencePromise . forEach (
404
+ testMutation . mutations ,
405
+ mutation => {
406
+ const indexKey = DbDocumentMutation . key (
407
+ testMutation . userId ,
408
+ path ( mutation . update . name , 5 ) ,
409
+ testMutation . batchId
410
+ ) ;
411
+ return documentMutationStore . put (
412
+ indexKey ,
413
+ DbDocumentMutation . PLACEHOLDER
414
+ ) ;
415
+ }
416
+ ) ;
417
+ } ) ;
418
+ } ) . next ( ( ) =>
419
419
// Populate the mutation queues' metadata
420
420
PersistencePromise . waitFor ( [
421
421
mutationQueuesStore . put ( new DbMutationQueue ( 'foo' , 2 , '' ) ) ,
422
422
mutationQueuesStore . put ( new DbMutationQueue ( 'bar' , 3 , '' ) ) ,
423
423
mutationQueuesStore . put ( new DbMutationQueue ( 'empty' , - 1 , '' ) )
424
424
] )
425
425
) ;
426
- return p ;
427
426
} ) ;
428
427
} ) . then ( ( ) =>
429
428
withDb ( 5 , db => {
0 commit comments