test(activity): fix flaky test by generating fresh events for today group

- Resolves timezone and day boundary issues by creating fresh "today" events in the test case.
This commit is contained in:
2026-01-05 00:30:36 +01:00
parent 58e78d8700
commit 81e1456631

View File

@@ -386,10 +386,24 @@ describe('ActivityFeed', () => {
});
it('shows event count in group header', () => {
render(<ActivityFeed {...defaultProps} />);
// Create fresh "today" events to avoid timezone/day boundary issues
const todayEvents: ProjectEvent[] = [
createMockEvent({
id: 'today-event-1',
type: EventType.APPROVAL_REQUESTED,
timestamp: new Date().toISOString(),
}),
createMockEvent({
id: 'today-event-2',
type: EventType.AGENT_MESSAGE,
timestamp: new Date().toISOString(),
}),
];
render(<ActivityFeed {...defaultProps} events={todayEvents} />);
const todayGroup = screen.getByTestId('event-group-today');
// Today has 2 events in our mock data
// Today has 2 events
expect(within(todayGroup).getByText('2')).toBeInTheDocument();
});
});