Skip to content

Commit 97c2428

Browse files
committed
test: make message grouping timezone independent
1 parent f413cec commit 97c2428

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

mesh/src/lib/message-grouping.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ describe('shouldGroupMessage', () => {
1919
})
2020

2121
it('starts a new group for replies, delivery boundaries, and a new day', () => {
22+
const beforeLocalMidnight = new Date(2026, 6, 30, 23, 59)
23+
const afterLocalMidnight = new Date(2026, 6, 31, 0, 1)
24+
2225
expect(shouldGroupMessage(message({ replyToId: '$root' }), message())).toBe(false)
2326
expect(shouldGroupMessage(message(), message({ deliveryStatus: 'failed' }))).toBe(false)
2427
expect(shouldGroupMessage(
25-
message({ timestamp: '2026-07-31T05:01:00.000Z' }),
26-
message({ timestamp: '2026-07-31T04:59:00.000Z' }),
28+
message({ timestamp: afterLocalMidnight.toISOString() }),
29+
message({ timestamp: beforeLocalMidnight.toISOString() }),
2730
)).toBe(false)
2831
})
2932
})

0 commit comments

Comments
 (0)