test(agenda): fixa o relógio do overlay no mês do fixture

O calendário abre no mês corrente e os fixtures (e o startAt submetido)
são de agosto/2026: desde 01/09 o teste 'troca dia no calendário' não
encontra o dia 15 de agosto e derruba a suíte unit full — que é o que o
gate e o CI rodam hoje (o wrapper changed cai no full). Relógio fixo no
mês do fixture torna o teste determinístico.
This commit is contained in:
Francisco Solla 2026-09-11 16:58:40 -03:00
parent a83b6dd50e
commit 2dead731d8

View file

@ -110,6 +110,13 @@ const openDatePicker = (label: string) => {
}
beforeAll(() => {
/*
* The fixtures (and the submitted `startAt`) live in August 2026 and the
* calendar picker opens on the CURRENT month: pin the clock to the fixture
* month so the day buttons stay reachable no matter when the suite runs.
*/
vi.useFakeTimers({ shouldAdvanceTime: true })
vi.setSystemTime(new Date('2026-08-10T15:00:00.000Z'))
vi.stubGlobal(
'ResizeObserver',
class {
@ -121,6 +128,7 @@ beforeAll(() => {
})
afterAll(() => {
vi.useRealTimers()
vi.unstubAllGlobals()
})