From e27e8285807dba4a813e2804acfb6ffb764670e8 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Tue, 21 Jan 2025 13:07:49 +0100 Subject: [PATCH] chore: move store deletion to `beforeEach` Instead of manually calling it in each test. --- .../traffic-data-usage/traffic-data-usage-store.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/features/traffic-data-usage/traffic-data-usage-store.test.ts b/src/lib/features/traffic-data-usage/traffic-data-usage-store.test.ts index 771a3cff0c..04604f7fe7 100644 --- a/src/lib/features/traffic-data-usage/traffic-data-usage-store.test.ts +++ b/src/lib/features/traffic-data-usage/traffic-data-usage-store.test.ts @@ -20,6 +20,10 @@ afterAll(async () => { await db.destroy(); }); +beforeEach(async () => { + await trafficDataUsageStore.deleteAll(); +}); + test('upsert stores new entries', async () => { const data = { day: new Date(), @@ -62,7 +66,6 @@ test('upsert upserts', async () => { }); test('getAll returns all', async () => { - await trafficDataUsageStore.deleteAll(); const data1 = { day: new Date(), trafficGroup: 'default3', @@ -83,7 +86,6 @@ test('getAll returns all', async () => { }); test('delete deletes the specified item', async () => { - await trafficDataUsageStore.deleteAll(); const data1 = { day: new Date(), trafficGroup: 'default3', @@ -110,7 +112,6 @@ test('delete deletes the specified item', async () => { }); test('can query for specific items', async () => { - await trafficDataUsageStore.deleteAll(); const data1 = { day: new Date(), trafficGroup: 'default3', @@ -154,7 +155,6 @@ test('can query for specific items', async () => { }); test('can query for data from specific periods', async () => { - await trafficDataUsageStore.deleteAll(); const data1 = { day: new Date(2024, 2, 12), trafficGroup: 'default-period-query',