@@ -780,14 +780,25 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
780
780
await withDb ( 9 , db => {
781
781
const sdb = new SimpleDb ( db ) ;
782
782
return sdb . runTransaction ( 'readwrite' , V8_STORES , txn => {
783
- // Verify the existing remote document entries.
784
- return addDocs ( txn , existingDocPaths , /* version= */ 1 ) . next ( ( ) =>
785
- addDocs ( txn , newDocPaths , /* version= */ 2 ) . next ( ( ) => {
786
- const remoteDocumentStore = txn . store <
787
- DbRemoteDocumentKey ,
788
- DbRemoteDocument
789
- > ( DbRemoteDocument . store ) ;
783
+ const remoteDocumentStore = txn . store <
784
+ DbRemoteDocumentKey ,
785
+ DbRemoteDocument
786
+ > ( DbRemoteDocument . store ) ;
790
787
788
+ // Verify the existing remote document entries.
789
+ return remoteDocumentStore
790
+ . loadAll ( )
791
+ . next ( docsRead => {
792
+ const keys = docsRead . map ( dbDoc => dbDoc . document ! . name ) ;
793
+ expect ( keys ) . to . have . members ( [
794
+ 'projects/test-project/databases/(default)/documents/coll1/doc1' ,
795
+ 'projects/test-project/databases/(default)/documents/coll1/doc2' ,
796
+ 'projects/test-project/databases/(default)/documents/coll2/doc1' ,
797
+ 'projects/test-project/databases/(default)/documents/coll2/doc2'
798
+ ] ) ;
799
+ } )
800
+ . next ( ( ) => addDocs ( txn , newDocPaths , /* version= */ 2 ) )
801
+ . next ( ( ) => {
791
802
// Verify that we can get recent changes in a collection filtered by
792
803
// read time.
793
804
const lastReadTime = TEST_SERIALIZER . toDbTimestampKey ( version ( 1 ) ) ;
@@ -804,8 +815,7 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
804
815
'projects/test-project/databases/(default)/documents/coll2/doc4'
805
816
] ) ;
806
817
} ) ;
807
- } )
808
- ) ;
818
+ } ) ;
809
819
} ) ;
810
820
} ) ;
811
821
} ) ;
0 commit comments