From 01dabd04d88881085025b8e2312a3080e553fa4f Mon Sep 17 00:00:00 2001 From: Robbie Date: Mon, 1 Jul 2024 16:51:39 +0100 Subject: [PATCH] fix: Fix bug that assumes that 2 months are 61 days apart (#23368) Fix bug that assumes that 2 months are 61 days apart --- .../services/replay-events-ingester.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin-server/tests/main/ingestion-queues/session-recording/services/replay-events-ingester.test.ts b/plugin-server/tests/main/ingestion-queues/session-recording/services/replay-events-ingester.test.ts index 4ede35c422f70..7da9cf2bda001 100644 --- a/plugin-server/tests/main/ingestion-queues/session-recording/services/replay-events-ingester.test.ts +++ b/plugin-server/tests/main/ingestion-queues/session-recording/services/replay-events-ingester.test.ts @@ -46,7 +46,9 @@ describe('replay events ingester', () => { }) test('does not ingest messages from a month in the future', async () => { - const twoMonthsFromNow = DateTime.utc().plus({ months: 2 }) + const now = DateTime.utc() + const twoMonthsFromNow = now.plus({ months: 2 }) + const expectedDaysFromNow = twoMonthsFromNow.diff(now, 'days').days await ingester.consume(makeIncomingMessage("mickey's fun house", twoMonthsFromNow.toMillis())) @@ -67,7 +69,7 @@ describe('replay events ingester', () => { expect(details).toEqual( expect.objectContaining({ isValid: true, - daysFromNow: 61, + daysFromNow: expectedDaysFromNow, timestamp: expectedTimestamp, }) )