@@ -398,32 +398,31 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
398398 DbMutationQueue
399399 > ( DbMutationQueue . store ) ;
400400 // 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 ( ( ) =>
419419 // Populate the mutation queues' metadata
420420 PersistencePromise . waitFor ( [
421421 mutationQueuesStore . put ( new DbMutationQueue ( 'foo' , 2 , '' ) ) ,
422422 mutationQueuesStore . put ( new DbMutationQueue ( 'bar' , 3 , '' ) ) ,
423423 mutationQueuesStore . put ( new DbMutationQueue ( 'empty' , - 1 , '' ) )
424424 ] )
425425 ) ;
426- return p ;
427426 } ) ;
428427 } ) . then ( ( ) =>
429428 withDb ( 5 , db => {
0 commit comments