Skip to content

Commit 6a60412

Browse files
committed
fix: stabilize mock event dates in tests to avoid day-spanning issues
1 parent 89f77a1 commit 6a60412

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/plugin-calendar/src/ObjectCalendar.msw.test.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@ const BASE_URL = 'http://localhost';
1111

1212
// --- Mock Data ---
1313

14+
// Create a stable date at noon to avoid day-spanning issues when tests run late at night
15+
const todayAtNoon = new Date();
16+
todayAtNoon.setHours(12, 0, 0, 0);
17+
1418
const mockEvents = {
1519
value: [
1620
{
1721
_id: '1',
1822
title: 'Meeting with Client',
19-
start: new Date().toISOString(),
20-
end: new Date(Date.now() + 3600000).toISOString(),
23+
start: todayAtNoon.toISOString(),
24+
end: new Date(todayAtNoon.getTime() + 3600000).toISOString(),
2125
type: 'business'
2226
},
2327
{
2428
_id: '2',
2529
title: 'Team Lunch',
26-
start: new Date(Date.now() + 86400000).toISOString(), // Tomorrow
30+
start: new Date(todayAtNoon.getTime() + 86400000).toISOString(), // Tomorrow
2731
type: 'personal'
2832
}
2933
]

0 commit comments

Comments
 (0)