import { it, expect } from 'vitest' import { liveDashboardQuery } from './qaDashboardData' const query = { start: '2026-10-19T00:00:00+08:00', end: '2026-10-20T08:00:00+08:00', keyword: 'needle', cursor: '', limit: 20, } it('advances current-week dashboard end on each refresh without mutating the executed filter', () => { const next = liveDashboardQuery(query, new Date('2026-10-20T09:00:00+08:00')) expect(next.end).toBe('2026-10-20T01:00:00.000Z') expect(next.start).toBe(query.start) expect(next.keyword).toBe(query.keyword) expect(query.end).toBe('2026-10-20T08:00:00+08:00') }) it('never rolls an already closed selected week into a different week', () => { const closed = { ...query, start: '2026-10-12T00:00:00+08:00', end: '2026-10-19T00:00:00+08:00' } expect(liveDashboardQuery(closed, new Date('2026-10-20T09:00:00+08:00'))).toEqual(closed) })