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:
parent
9a5d965636
commit
a7d581aa7d
@ -79,18 +79,19 @@ test('project insights should return correct count for each day', async () => {
|
|||||||
const yesterdayEvent = events.find(
|
const yesterdayEvent = events.find(
|
||||||
(e) => e.data.featureName === 'yesterday-event',
|
(e) => e.data.featureName === 'yesterday-event',
|
||||||
);
|
);
|
||||||
await db.rawDatabase.raw(
|
|
||||||
`UPDATE events SET created_at = '2024-11-03' where id = ?`,
|
const { todayString, yesterdayString } = getCurrentDateStrings();
|
||||||
[yesterdayEvent?.id],
|
|
||||||
);
|
await db.rawDatabase.raw(`UPDATE events SET created_at = ? where id = ?`, [
|
||||||
|
yesterdayString,
|
||||||
|
yesterdayEvent?.id,
|
||||||
|
]);
|
||||||
|
|
||||||
const { body } = await app.request
|
const { body } = await app.request
|
||||||
.get('/api/admin/projects/default/status')
|
.get('/api/admin/projects/default/status')
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
const { todayString, yesterdayString } = getCurrentDateStrings();
|
|
||||||
|
|
||||||
expect(body).toMatchObject({
|
expect(body).toMatchObject({
|
||||||
activityCountByDate: [
|
activityCountByDate: [
|
||||||
{ date: yesterdayString, count: 1 },
|
{ date: yesterdayString, count: 1 },
|
||||||
|
Loading…
Reference in New Issue
Block a user