Skip to content

Commit 18b485a

Browse files
committed
Add migration tests.
1 parent 36bdc2e commit 18b485a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ import {
7575
V12_STORES,
7676
V13_STORES,
7777
V14_STORES,
78+
V15_STORES,
79+
V16_STORES,
80+
V17_STORES,
7881
V1_STORES,
7982
V3_STORES,
8083
V4_STORES,
@@ -1229,6 +1232,30 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
12291232
});
12301233
});
12311234

1235+
it('can upgrade from version 14 to 15', async () => {
1236+
await withDb(14, async () => {});
1237+
await withDb(15, async (db, version, objectStores) => {
1238+
expect(version).to.have.equal(14);
1239+
expect(objectStores).to.have.members(V15_STORES);
1240+
});
1241+
});
1242+
1243+
it('can upgrade from version 15 to 16', async () => {
1244+
await withDb(15, async () => {});
1245+
await withDb(16, async (db, version, objectStores) => {
1246+
expect(version).to.have.equal(15);
1247+
expect(objectStores).to.have.members(V16_STORES);
1248+
});
1249+
});
1250+
1251+
it('can upgrade from version 16 to 17', async () => {
1252+
await withDb(16, async () => {});
1253+
await withDb(17, async (db, version, objectStores) => {
1254+
expect(version).to.have.equal(16);
1255+
expect(objectStores).to.have.members(V17_STORES);
1256+
});
1257+
});
1258+
12321259
it('downgrading throws a custom error', async function (this: Context) {
12331260
// Upgrade to latest version
12341261
await withDb(SCHEMA_VERSION, async (db, version) => {

0 commit comments

Comments
 (0)