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:
@@ -386,10 +386,24 @@ describe('ActivityFeed', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('shows event count in group header', () => {
|
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');
|
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();
|
expect(within(todayGroup).getByText('2')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user