From a7d581aa7d6891c6ef6c2e3489b40c587c1501a0 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Tue, 5 Nov 2024 09:15:54 +0100 Subject: [PATCH] fix: set a dynamic yesterday date instead of a fixed one. (#8646) This was an oversight. The test would always fail after 2024-11-04, because yesterday is no longer 2024-11-03. This way, we're using the same string in both places. --- .../project-status/projects-status.e2e.test.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/features/project-status/projects-status.e2e.test.ts b/src/lib/features/project-status/projects-status.e2e.test.ts index cf757e20b5f3..dfa9bd93ca31 100644 --- a/src/lib/features/project-status/projects-status.e2e.test.ts +++ b/src/lib/features/project-status/projects-status.e2e.test.ts @@ -79,18 +79,19 @@ test('project insights should return correct count for each day', async () => { const yesterdayEvent = events.find( (e) => e.data.featureName === 'yesterday-event', ); - await db.rawDatabase.raw( - `UPDATE events SET created_at = '2024-11-03' where id = ?`, - [yesterdayEvent?.id], - ); + + const { todayString, yesterdayString } = getCurrentDateStrings(); + + await db.rawDatabase.raw(`UPDATE events SET created_at = ? where id = ?`, [ + yesterdayString, + yesterdayEvent?.id, + ]); const { body } = await app.request .get('/api/admin/projects/default/status') .expect('Content-Type', /json/) .expect(200); - const { todayString, yesterdayString } = getCurrentDateStrings(); - expect(body).toMatchObject({ activityCountByDate: [ { date: yesterdayString, count: 1 },