fix(worker): show paused time in history; reset to stopwatch on logout
This commit is contained in:
@@ -31,6 +31,8 @@ function session(overrides: Partial<WorkSession> = {}): WorkSession {
|
||||
start_time: '2026-01-02T08:30:00.000Z',
|
||||
end_time: '2026-01-02T09:31:01.000Z',
|
||||
duration_seconds: 3661,
|
||||
paused_seconds: 0,
|
||||
paused_at: null,
|
||||
status: 'completed',
|
||||
source: 'app',
|
||||
notes: null,
|
||||
@@ -44,7 +46,7 @@ function renderHistory() {
|
||||
return render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<History />
|
||||
</QueryClientProvider>,
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -94,6 +96,23 @@ describe('History', () => {
|
||||
expect(card.textContent).not.toContain('1 inlegzolen');
|
||||
});
|
||||
|
||||
it('renders a Pauze line when paused_seconds > 0', async () => {
|
||||
mockedApiFetch.mockResolvedValue([session({ paused_seconds: 125 })]);
|
||||
renderHistory();
|
||||
|
||||
const card = (await screen.findByText('Frezen')).closest('.session-card') as HTMLElement;
|
||||
// 125s -> "2m 5s".
|
||||
expect(card.textContent).toContain('Pauze 2m 5s');
|
||||
});
|
||||
|
||||
it('does not render a Pauze line when paused_seconds is 0', async () => {
|
||||
mockedApiFetch.mockResolvedValue([session({ paused_seconds: 0 })]);
|
||||
renderHistory();
|
||||
|
||||
const card = (await screen.findByText('Frezen')).closest('.session-card') as HTMLElement;
|
||||
expect(card.textContent).not.toContain('Pauze');
|
||||
});
|
||||
|
||||
it('triggers the CSV download on Exporteer CSV', async () => {
|
||||
const user = userEvent.setup();
|
||||
renderHistory();
|
||||
|
||||
Reference in New Issue
Block a user