Skip to content

Commit 5fc5fc8

Browse files
committed
query_engine.test.ts: fix failing CSI tests
1 parent 55cdb25 commit 5fc5fc8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ import {
8282

8383
import * as persistenceHelpers from './persistence_test_helpers';
8484
import { TestIndexManager } from './test_index_manager';
85+
import {
86+
IndexedDbIndexManager,
87+
indexedDbIndexManagerInstallFieldIndexPlugin
88+
} from '../../../src/local/indexeddb_index_manager';
8589

8690
const TEST_TARGET_ID = 1;
8791

@@ -271,6 +275,16 @@ function genericQueryEngineTest(
271275
queryEngine = new QueryEngine();
272276

273277
underlyingIndexManager = persistence.getIndexManager(User.UNAUTHENTICATED);
278+
if (configureCsi) {
279+
if (!(underlyingIndexManager instanceof IndexedDbIndexManager)) {
280+
throw new Error(
281+
'persistence.getIndexManager() should have ' +
282+
'returned an instance of IndexedDbIndexManager'
283+
);
284+
}
285+
indexedDbIndexManagerInstallFieldIndexPlugin(underlyingIndexManager);
286+
}
287+
274288
remoteDocumentCache = persistence.getRemoteDocumentCache();
275289
remoteDocumentCache.setIndexManager(underlyingIndexManager);
276290
mutationQueue = persistence.getMutationQueue(
@@ -287,6 +301,9 @@ function genericQueryEngineTest(
287301
underlyingIndexManager
288302
);
289303
queryEngine.initialize(localDocuments, underlyingIndexManager);
304+
if (configureCsi) {
305+
queryEngineInstallFieldIndexPlugin(queryEngine);
306+
}
290307

291308
indexManager = new TestIndexManager(persistence, underlyingIndexManager);
292309
});

0 commit comments

Comments
 (0)