Skip to content

Commit 3537fe2

Browse files
Fixing the tests
1 parent 6b072ff commit 3537fe2

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

packages/firestore/src/local/indexeddb_persistence.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { IndexedDbMutationQueue } from './indexeddb_mutation_queue';
2626
import { IndexedDbQueryCache } from './indexeddb_query_cache';
2727
import { IndexedDbRemoteDocumentCache } from './indexeddb_remote_document_cache';
2828
import {
29-
ALL_STORES,
29+
DEFAULT_STORES,
3030
createOrUpgradeDb,
3131
DbOwner,
3232
DbOwnerKey,
@@ -181,7 +181,7 @@ export class IndexedDbPersistence implements Persistence {
181181

182182
// Do all transactions as readwrite against all object stores, since we
183183
// are the only reader/writer.
184-
return this.simpleDb.runTransaction('readwrite', ALL_STORES, txn => {
184+
return this.simpleDb.runTransaction('readwrite', DEFAULT_STORES, txn => {
185185
// Verify that we still have the owner lease as part of every transaction.
186186
return this.ensureOwnerLease(txn).next(() => operation(txn));
187187
});

packages/firestore/src/local/indexeddb_schema.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,7 @@ function createClientMetadataStore(db: IDBDatabase): void {
563563
});
564564
}
565565

566-
// Exported for testing.
567-
export const V1_STORES = [
566+
const V1_STORES = [
568567
DbMutationQueue.store,
569568
DbMutationBatch.store,
570569
DbDocumentMutation.store,
@@ -578,7 +577,13 @@ export const V1_STORES = [
578577
const V2_STORES = [DbClientMetadata.store, DbTargetChange.store];
579578

580579
/**
581-
* The list of all IndexedDB stores used by the SDK. This is used when creating
582-
* transactions so that access across all stores is done atomically.
580+
* The list of all default IndexedDB stores used by the SDK. This is used when
581+
* creating transactions so that access across all stores is done atomically.
582+
*/
583+
export const DEFAULT_STORES = V1_STORES;
584+
585+
/**
586+
* The list of all IndexedDb stores. This is only available in clients with
587+
* the schema version 2.
583588
*/
584589
export const ALL_STORES = [...V1_STORES, ...V2_STORES];

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
import { expect } from 'chai';
1818
import { IndexedDbPersistence } from '../../../src/local/indexeddb_persistence';
1919
import {
20-
ALL_STORES,
20+
DEFAULT_STORES,
2121
createOrUpgradeDb,
22-
V1_STORES
22+
ALL_STORES
2323
} from '../../../src/local/indexeddb_schema';
2424
import { Deferred } from '../../../src/util/promise';
2525
import { SimpleDb } from '../../../src/local/simple_db';
@@ -67,7 +67,7 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
6767
it('can install schema version 1', () => {
6868
return initDb(1).then(db => {
6969
expect(db.version).to.be.equal(1);
70-
expect(getAllObjectStores(db)).to.have.members(V1_STORES);
70+
expect(getAllObjectStores(db)).to.have.members(DEFAULT_STORES);
7171
});
7272
});
7373

0 commit comments

Comments
 (0)