1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

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.
This commit is contained in:
Thomas Heartman 2024-11-05 09:15:54 +01:00 committed by GitHub
parent 9a5d965636
commit a7d581aa7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 },