From 0633e7caabffc60e88c4e236f3ccd7dd614b238e Mon Sep 17 00:00:00 2001 From: Shepherd Date: Thu, 19 Sep 2024 10:30:46 -0400 Subject: [PATCH] Add v6 test to check that old tables are deleted --- __test__/unit/services/indexedDb.test.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/__test__/unit/services/indexedDb.test.ts b/__test__/unit/services/indexedDb.test.ts index c654e2fb0..7beec5d21 100644 --- a/__test__/unit/services/indexedDb.test.ts +++ b/__test__/unit/services/indexedDb.test.ts @@ -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);