Skip to content

Commit

Permalink
fix: Fix bug that assumes that 2 months are 61 days apart (#23368)
Browse files Browse the repository at this point in the history
Fix bug that assumes that 2 months are 61 days apart
  • Loading branch information
robbie-c authored Jul 1, 2024
1 parent 3ff87c1 commit 01dabd0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()))

Expand All @@ -67,7 +69,7 @@ describe('replay events ingester', () => {
expect(details).toEqual(
expect.objectContaining({
isValid: true,
daysFromNow: 61,
daysFromNow: expectedDaysFromNow,
timestamp: expectedTimestamp,
})
)
Expand Down

0 comments on commit 01dabd0

Please sign in to comment.