Skip to content

Commit bdac12d

Browse files
Test merge
1 parent f11a000 commit bdac12d

File tree

5 files changed

+27
-103
lines changed

5 files changed

+27
-103
lines changed

packages/firestore/src/local/indexeddb_schema.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,13 @@ export const V1_STORES = [
642642
DbTargetDocument.store
643643
];
644644

645-
const V3_STORES = [DbClientMetadata.store, DbTargetChange.store];
645+
export const V2_STORES = V1_STORES;
646+
647+
const V3_STORES = [...V2_STORES, DbClientMetadata.store, DbTargetChange.store];
646648

647649
/**
648650
* The list of all default IndexedDB stores used throughout the SDK. This is
649651
* used when creating transactions so that access across all stores is done
650652
* atomically.
651653
*/
652-
export const ALL_STORES = [...V1_STORES, ...V3_STORES];
654+
export const ALL_STORES = V3_STORES;

packages/firestore/src/local/memory_persistence.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,10 @@ export class MemoryPersistence implements Persistence {
5252

5353
private started = false;
5454

55-
<<<<<<< HEAD
5655
constructor(private readonly queue: AsyncQueue) {}
5756

58-
start(): Promise<void> {
59-
=======
6057
async start(): Promise<void> {
6158
// No durable state to read on startup.
62-
>>>>>>> master
6359
assert(!this.started, 'MemoryPersistence double-started!');
6460
this.started = true;
6561
}

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

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import {
2121
createOrUpgradeDb,
2222
DbTarget,
2323
DbTargetGlobal,
24-
DbTargetGlobalKey
24+
DbTargetGlobalKey, V1_STORES, V2_STORES
2525
} from '../../../src/local/indexeddb_schema';
2626
import { SimpleDb, SimpleDbTransaction } from '../../../src/local/simple_db';
2727
import { PersistencePromise } from '../../../src/local/persistence_promise';
28+
import {asyncQueue} from '../../integration/util/internal_helpers';
2829

2930
const INDEXEDDB_TEST_DATABASE = 'schemaTest';
3031

@@ -88,11 +89,10 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
8889
beforeEach(() => SimpleDb.delete(INDEXEDDB_TEST_DATABASE));
8990

9091
it('can install schema version 1', () => {
91-
return withDb(1, db => {
92+
return withDb(1, async db => {
9293
expect(db.version).to.equal(1);
9394
// Version 1 adds all of the stores so far.
94-
expect(getAllObjectStores(db)).to.have.members(ALL_STORES);
95-
return Promise.resolve();
95+
expect(getAllObjectStores(db)).to.have.members(V2_STORES);
9696
});
9797
});
9898

@@ -101,14 +101,21 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
101101
expect(db.version).to.equal(2);
102102
// We should have all of the stores, we should have the target global row
103103
// and we should not have any targets counted, because there are none.
104-
expect(getAllObjectStores(db)).to.have.members(ALL_STORES);
104+
expect(getAllObjectStores(db)).to.have.members(V2_STORES);
105105
// Check the target count. We haven't added any targets, so we expect 0.
106106
return getTargetCount(db).then(targetCount => {
107107
expect(targetCount).to.equal(0);
108108
});
109109
});
110110
});
111111

112+
it('can install schema version 3', () => {
113+
return withDb(3, async db => {
114+
expect(db.version).to.be.equal(3);
115+
expect(getAllObjectStores(db)).to.have.members(ALL_STORES);
116+
});
117+
});
118+
112119
it('can upgrade from schema version 1 to 2', () => {
113120
const expectedTargetCount = 5;
114121
return withDb(1, db => {
@@ -126,11 +133,20 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
126133
}).then(() =>
127134
withDb(2, db => {
128135
expect(db.version).to.equal(2);
129-
expect(getAllObjectStores(db)).to.have.members(ALL_STORES);
136+
expect(getAllObjectStores(db)).to.have.members(V2_STORES);
130137
return getTargetCount(db).then(targetCount => {
131138
expect(targetCount).to.equal(expectedTargetCount);
132139
});
133140
})
134141
);
135142
});
143+
144+
it('can upgrade from schema version 2 to 3', () => {
145+
return withDb(2, async () => {}).then(() =>
146+
withDb(3, async db => {
147+
expect(db.version).to.be.equal(3);
148+
expect(getAllObjectStores(db)).to.have.members(ALL_STORES);
149+
})
150+
);
151+
});
136152
});

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

Lines changed: 0 additions & 90 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class TestQueryCache {
4343
}
4444

4545
updateQueryData(queryData: QueryData): Promise<void> {
46-
return this.persistence.runTransaction('updateQueryData', txn => {
46+
return this.persistence.runTransaction('updateQueryData', true, txn => {
4747
return this.cache.updateQueryData(txn, queryData);
4848
});
4949
}

0 commit comments

Comments
 (0)