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
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:
1 parent
af20c96f01
commit
036b13613c
1 file changed
+12
@@ -8,6 +8,7 @@ import {
|
|||||||
SelectedDates,
|
SelectedDates,
|
||||||
} from './calendar-service';
|
} from './calendar-service';
|
||||||
import { DateRange } from '@angular/material/datepicker';
|
import { DateRange } from '@angular/material/datepicker';
|
||||||
|
import { vi } from '../../testing/vitest-compat';
|
||||||
|
|
||||||
describe('CalendarService', () => {
|
describe('CalendarService', () => {
|
||||||
let service: CalendarService;
|
let service: CalendarService;
|
||||||
@@ -197,6 +198,8 @@ describe('CalendarService', () => {
|
|||||||
service.project({ placements: [], horizon });
|
service.project({ placements: [], horizon });
|
||||||
const day = (key: string) => new Date(`${key}T00:00:00`);
|
const day = (key: string) => new Date(`${key}T00:00:00`);
|
||||||
|
|
||||||
|
afterEach(() => vi.useRealTimers());
|
||||||
|
|
||||||
it('projects weekends, holidays and today for the default planning horizon', () => {
|
it('projects weekends, holidays and today for the default planning horizon', () => {
|
||||||
const { selections } = project({ start: '2026-01-01', end: '2027-01-01' });
|
const { selections } = project({ start: '2026-01-01', end: '2027-01-01' });
|
||||||
expect(selections.dayTypes(day('2026-05-09'))).toContain(DayType.WEEKEND);
|
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', () => {
|
it('lists the covered months, including partial boundary months and year changes', () => {
|
||||||
expect(project({ start: '2024-11-20', end: '2025-02-02' }).months).toEqual([
|
expect(project({ start: '2024-11-20', end: '2025-02-02' }).months).toEqual([
|
||||||
{ monthIndex: 10, year: 2024 },
|
{ monthIndex: 10, year: 2024 },
|
||||||
|
|||||||
Reference in new issue
Block a user