Skip to content

Commit c1cc744

Browse files
committed
Fix migration test
1 parent 18b485a commit c1cc744

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ async function withDb(
139139
schemaConverter
140140
);
141141
const database = await simpleDb.ensureDb('IndexedDbPersistenceTests');
142-
await fn(simpleDb, database.version, Array.from(database.objectStoreNames));
143-
await simpleDb.close();
142+
return fn(
143+
simpleDb,
144+
database.version,
145+
Array.from(database.objectStoreNames)
146+
).finally(async () => simpleDb.close());
144147
}
145148

146149
async function withUnstartedCustomPersistence(
@@ -1235,23 +1238,23 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
12351238
it('can upgrade from version 14 to 15', async () => {
12361239
await withDb(14, async () => {});
12371240
await withDb(15, async (db, version, objectStores) => {
1238-
expect(version).to.have.equal(14);
1241+
expect(version).to.have.equal(15);
12391242
expect(objectStores).to.have.members(V15_STORES);
12401243
});
12411244
});
12421245

12431246
it('can upgrade from version 15 to 16', async () => {
12441247
await withDb(15, async () => {});
12451248
await withDb(16, async (db, version, objectStores) => {
1246-
expect(version).to.have.equal(15);
1249+
expect(version).to.have.equal(16);
12471250
expect(objectStores).to.have.members(V16_STORES);
12481251
});
12491252
});
12501253

12511254
it('can upgrade from version 16 to 17', async () => {
12521255
await withDb(16, async () => {});
12531256
await withDb(17, async (db, version, objectStores) => {
1254-
expect(version).to.have.equal(16);
1257+
expect(version).to.have.equal(17);
12551258
expect(objectStores).to.have.members(V17_STORES);
12561259
});
12571260
});

0 commit comments

Comments
 (0)