diff --git a/src/app/services/calendar-service.spec.ts b/src/app/services/calendar-service.spec.ts index ec749a9..912c641 100644 --- a/src/app/services/calendar-service.spec.ts +++ b/src/app/services/calendar-service.spec.ts @@ -8,6 +8,7 @@ import { SelectedDates, } from './calendar-service'; import { DateRange } from '@angular/material/datepicker'; +import { vi } from '../../testing/vitest-compat'; describe('CalendarService', () => { let service: CalendarService; @@ -197,6 +198,8 @@ describe('CalendarService', () => { service.project({ placements: [], horizon }); const day = (key: string) => new Date(`${key}T00:00:00`); + afterEach(() => vi.useRealTimers()); + it('projects weekends, holidays and today for the default planning horizon', () => { const { selections } = project({ start: '2026-01-01', end: '2027-01-01' }); expect(selections.dayTypes(day('2026-05-09'))).toContain(DayType.WEEKEND); @@ -207,6 +210,15 @@ describe('CalendarService', () => { ); }); + it('marks today on the Europe/Paris date when the runtime date is still the day before', () => { + vi.setSystemTime(new Date('2026-10-17T22:16:00Z')); + const horizon = service.getDefaultPlanningHorizon(); + expect(horizon.start).toBe('2026-10-18'); + const { selections } = project(horizon); + expect(selections.getClasses(day('2026-10-18'))).toContain(DayType.TODAY); + expect(selections.getClasses(day('2026-10-17'))).not.toContain(DayType.TODAY); + }); + it('lists the covered months, including partial boundary months and year changes', () => { expect(project({ start: '2024-11-20', end: '2025-02-02' }).months).toEqual([ { monthIndex: 10, year: 2024 },