Skip to content

Commit 4ec62ae

Browse files
committed
Guard test against missing path.
1 parent 06f71c9 commit 4ec62ae

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

packages/firestore/test/integration/api/query.test.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ import {
6464
toChangesArray,
6565
toDataArray,
6666
PERSISTENCE_MODE_UNSPECIFIED,
67-
withAlternateTestDb,
6867
withEmptyTestCollection,
6968
withRetry,
7069
withTestCollection,
@@ -77,7 +76,7 @@ import { captureExistenceFilterMismatches } from '../util/testing_hooks_util';
7776
apiDescribe('Queries', persistence => {
7877
addEqualityMatcher();
7978

80-
it('DDB4 local QuerySnapshot.toJSON bundle getDocFromCache', async () => {
79+
it('QuerySnapshot.toJSON bundle getDocFromCache', async () => {
8180
let path: string | null = null;
8281
let jsonBundle: object | null = null;
8382
const testDocs = {
@@ -100,22 +99,21 @@ apiDescribe('Queries', persistence => {
10099
});
101100
});
102101
expect(jsonBundle).to.not.be.null;
103-
console.log("DEDB json bundle: ", jsonBundle);
104102
// eslint-disable-next-line @typescript-eslint/no-explicit-any
105103
const json = (jsonBundle as any).bundle;
106104
expect(json).to.exist;
107105
expect(json.length).to.be.greaterThan(0);
108-
// Use a new instance to load the bundle to ensure that the cache is primed by the bundle and
109-
// not the previous getDocs call.
110-
await withTestDb(persistence, async db => {
111-
await loadBundle(db, json);
112-
const docRef = doc(db, path!);
113-
const docSnap = await getDocFromCache(docRef);
114-
expect(docSnap.exists);
115-
expect(docSnap.data()).to.deep.equal(testDocs.a);
116-
console.log("DEDB metadata.fromCache: ", docSnap.metadata.fromCache);
117-
//expect(docSnap.metadata.fromCache).to.be.true;
118-
});
106+
107+
if (path !== null) {
108+
await withTestDb(persistence, async db => {
109+
const docRef = doc(db, path!);
110+
await loadBundle(db, json);
111+
112+
const docSnap = await getDocFromCache(docRef);
113+
expect(docSnap.exists);
114+
expect(docSnap.data()).to.deep.equal(testDocs.a);
115+
});
116+
}
119117
});
120118

121119
it('can issue limit queries', () => {

0 commit comments

Comments
 (0)