Skip to content

Commit abf072d

Browse files
Fix test
1 parent cf91ba6 commit abf072d

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

packages/firestore/test/unit/local/indexeddb_persistence.test.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -780,14 +780,25 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
780780
await withDb(9, db => {
781781
const sdb = new SimpleDb(db);
782782
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);
790787

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(() => {
791802
// Verify that we can get recent changes in a collection filtered by
792803
// read time.
793804
const lastReadTime = TEST_SERIALIZER.toDbTimestampKey(version(1));
@@ -804,8 +815,7 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
804815
'projects/test-project/databases/(default)/documents/coll2/doc4'
805816
]);
806817
});
807-
})
808-
);
818+
});
809819
});
810820
});
811821
});

0 commit comments

Comments
 (0)