Skip to content

Commit

Permalink
Add v6 test to check that old tables are deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
shepherd-l committed Sep 19, 2024
1 parent c15ed25 commit 0633e7c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions __test__/unit/services/indexedDb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,29 @@ describe('migrations', () => {
]);
});

test('removes v5 email, push, sms subscriptions tables', async () => {
const dbName = 'testDbV5upgradeToV6' + Random.getRandomString(10);
const db = newOSIndexedDb(dbName, 5);
db.close();

const db2 = newOSIndexedDb(dbName, 6);
await expect(
db2.getAll(LegacyModelName.EmailSubscriptions),
).rejects.toThrow(
'No objectStore named emailSubscriptions in this database',
);
await expect(
db2.getAll(LegacyModelName.SmsSubscriptions),
).rejects.toThrow(
'No objectStore named smsSubscriptions in this database',
);
await expect(
db2.getAll(LegacyModelName.PushSubscriptions),
).rejects.toThrow(
'No objectStore named pushSubscriptions in this database',
);
});

test('migrates v5 email, push, sms subscriptions records of logged in user to v6 subscriptions record with external id', async () => {
const dbName = 'testDbV5upgradeToV6' + Random.getRandomString(10);
const db = newOSIndexedDb(dbName, 5);
Expand Down

0 comments on commit 0633e7c

Please sign in to comment.