Skip to content

Commit

Permalink
fix: set a dynamic yesterday date instead of a fixed one. (#8646)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomasheartman authored Nov 5, 2024
1 parent 9a5d965 commit a7d581a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/lib/features/project-status/projects-status.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit a7d581a

Please sign in to comment.