test(calendar): pin the clock for the Paris today marker
CI / policy (push) Successful in 26s
CI / validate (push) Successful in 28s
CI / build (push) Successful in 23s
CI / benchmark (push) Successful in 1m26s
CI / security (push) Successful in 1m14s
CI / test (push) Successful in 1m58s
CI / images (push) Successful in 57s
CI / required (push) Successful in 3s
CI / policy (pull_request) Failing after 10s
CI / validate (pull_request) Successful in 26s
CI / build (pull_request) Successful in 21s
CI / benchmark (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 58s
CI / test (pull_request) Successful in 1m52s
CI / images (pull_request) Skipped
CI / required (pull_request) Failing after 1s

The test of the today marker read the wall clock, so it only exercised
the Paris/local date mismatch between 22:00 and 24:00 UTC and passed
with or without the fix the rest of the day. Pin the clock to 22:16 UTC,
already the next day in Paris, so a UTC runner fails without the fix at
any time.

Refs #301

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nessarandClaude Sonnet 5.5 committed 2026-10-19 10:21:54 +02:00
1 parent af20c96f01
commit 036b13613c
1 file changed
+12
+12
View File
@@ -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 },