# GitLab !64: Fix unit tests for VacDay[] type migration Original: `nessar/vac-optimizer`; GitLab MergeRequest ID 119. Target: [#142](https://gitea.nessar.fr/nessar/vac-optimizer/pulls/142). Author: admin-backup (GitLab user 3). Created: 2025-11-30T02:06:33.000Z. Last source update: 2025-11-30T02:12:58.000Z. Source state: merged; discussion locked: False. This linked record preserves source attribution, timestamps, discussion grouping, review positions and historical diffs. Current Gitea activity is separate from the original source dates. Old CI jobs and their reports are omitted by owner decision. Source requested reviewers: admin-backup (GitLab user 3). ## Discussions and activity ### Discussion 88c666a6a5f7bcf500eaad4c9da64a53dbbddfff #### Source note 563 — admin-backup (GitLab user 3) — 2025-11-30T02:06:33Z system activity. ````text assigned to `@Copilot` ```` ### Discussion 256ac2e1d28260a325091adabcc2123719052d6d #### Source note 564 — admin-backup (GitLab user 3) — 2025-11-30T02:06:33Z system activity. ````text assigned to `@THoguet` ```` ### Discussion d8e89cdc4487e1791bfca0bc8c4262c9c8577658 #### Source note 567 — admin-backup (GitLab user 3) — 2025-11-30T02:06:36Z system activity. ````text mentioned in merge request !61 ```` ### Discussion da229caf06e5b42a450f8ae1922a5ba1c13892cc #### Source note 566 — admin-backup (GitLab user 3) — 2025-11-30T02:12:23Z ````text Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. > [!WARNING] > >
> Firewall rules blocked me from connecting to one or more addresses (expand for details) > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `accounts.google.com` > - Triggering command: `/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3626 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-4634782 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4115905472836938781,18327784655836221968,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041` (dns block) > - Triggering command: `/opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-4634782 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=4634782 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222` (dns block) > - `clients2.google.com` > - Triggering command: `/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3626 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-4634782 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4115905472836938781,18327784655836221968,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041` (dns block) > - Triggering command: `/opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-4634782 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=4634782 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222` (dns block) > - `clientservices.googleapis.com` > - Triggering command: `/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3626 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-4634782 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4115905472836938781,18327784655836221968,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041` (dns block) > - Triggering command: `/opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-4634782 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=4634782 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222` (dns block) > - `redirector.gvt1.com` > - Triggering command: `/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3626 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-4634782 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4115905472836938781,18327784655836221968,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041` (dns block) > - Triggering command: `/opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-4634782 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=4634782 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222` (dns block) > - `safebrowsingohttpgateway.googleapis.com` > - Triggering command: `/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3626 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-4634782 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4115905472836938781,18327784655836221968,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041` (dns block) > - Triggering command: `/opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-4634782 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=4634782 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222` (dns block) > - `www.google.com` > - Triggering command: `/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3626 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-4634782 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4115905472836938781,18327784655836221968,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041` (dns block) > - Triggering command: `/opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-4634782 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=4634782 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/THoguet/vac-optimizer/settings/copilot/coding_agent) (admins only) > >
```` ### Discussion 950ee275aa068af03ae58d18053ebf585d7b3ee0 #### Source note 568 — admin-backup (GitLab user 3) — 2025-11-30T02:12:24Z system activity. ````text changed title from **{-[WIP] Refact-}or {-v-}ac{-ation management system with day tracking-}** to **{+Fix unit tests f+}or {+V+}ac{+Day[] type migration+}** ```` ### Discussion 72d962edbfd647ff2dea2c104b615b13a8b6f81a #### Source note 569 — admin-backup (GitLab user 3) — 2025-11-30T02:12:36Z system activity. ````text requested review from `@THoguet` ```` ### Discussion 29230e9890bd10a430fe06df8a3c7118cfa7cc7f #### Source note 570 — admin-backup (GitLab user 3) — 2025-11-30T02:12:58Z ````text *Merged by: THoguet at 2025-11-30 02:12:58 UTC* ```` ## State event records - {"close_after_error_tracking_resolve": false, "close_auto_resolve_prometheus_alert": false, "created_at": "2025-11-30T02:12:58+00:00", "epic_id": null, "id": 289, "imported_from": 4, "issue_id": null, "merge_request_id": 119, "namespace_id": 38, "source_commit": null, "source_merge_request_id": null, "state": 2, "user_id": 3} - {"close_after_error_tracking_resolve": false, "close_auto_resolve_prometheus_alert": false, "created_at": "2025-11-30T02:12:58+00:00", "epic_id": null, "id": 291, "imported_from": 4, "issue_id": null, "merge_request_id": 119, "namespace_id": 38, "source_commit": "a1f4b6b3f49aa74bc5b4fa4d4796fdabc3983b14", "source_merge_request_id": null, "state": 3, "user_id": 3} ## Historical diff versions ### Diff version 119 — 2026-05-03T16:00:01.043942Z Base `480bcc897e79b456741454b6a098a1901ece326b`; start `480bcc897e79b456741454b6a098a1901ece326b`; head `118066dbdd89bfa79eb8516c3907e601040c3893`. Files: 2; stored commits: 2. #### `src/app/components/user-input/user-input.spec.ts` → `None` Modes 100644 → 100644; new=False, deleted=False, renamed=False, binary=False, too_large=False. ````diff @@ -2,10 +2,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { provideZonelessChangeDetection } from '@angular/core'; import { UserInput } from './user-input'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; +import { UserInputService } from '../../services/user-input-service'; describe('UserInput', () => { let component: UserInput; let fixture: ComponentFixture; + let userInputService: UserInputService; beforeEach(async () => { await TestBed.configureTestingModule({ @@ -15,6 +17,7 @@ describe('UserInput', () => { fixture = TestBed.createComponent(UserInput); component = fixture.componentInstance; + userInputService = TestBed.inject(UserInputService); fixture.detectChanges(); }); @@ -22,20 +25,22 @@ describe('UserInput', () => { expect(component).toBeTruthy(); }); - it('should initialize form with values from service', () => { - expect(component.userInputForm).toBeDefined(); - expect(component.userInputForm.get('CP')).toBeDefined(); - expect(component.userInputForm.get('RTT')).toBeDefined(); - expect(component.userInputForm.get('Others')).toBeDefined(); + it('should initialize with vacation days from service', () => { + const vacationDays = userInputService.vacationNumberSignal(); + expect(vacationDays).toBeDefined(); + expect(Array.isArray(vacationDays)).toBe(true); + expect(vacationDays.length).toBeGreaterThan(0); }); - it('should have valid form controls', () => { - const cpControl = component.userInputForm.get('CP'); - const rttControl = component.userInputForm.get('RTT'); - const othersControl = component.userInputForm.get('Others'); + it('should add a new vacation day', () => { + const initialLength = userInputService.vacationNumberSignal().length; + component.addDay(); + expect(userInputService.vacationNumberSignal().length).toBe(initialLength + 1); + }); - expect(cpControl).toBeTruthy(); - expect(rttControl).toBeTruthy(); - expect(othersControl).toBeTruthy(); + it('should remove a vacation day', () => { + const initialLength = userInputService.vacationNumberSignal().length; + component.removeFromList(0); + expect(userInputService.vacationNumberSignal().length).toBe(initialLength - 1); }); }); ```` #### `src/app/services/user-input-service.spec.ts` → `None` Modes 100644 → 100644; new=False, deleted=False, renamed=False, binary=False, too_large=False. ````diff @@ -1,8 +1,9 @@ import { TestBed } from '@angular/core/testing'; import { provideZonelessChangeDetection } from '@angular/core'; import { UserInputService } from './user-input-service'; +import { SelectableDayType, VacDay } from './calendar-service'; -describe('UserInput', () => { +describe('UserInputService', () => { let service: UserInputService; beforeEach(() => { @@ -16,19 +17,41 @@ describe('UserInput', () => { expect(service).toBeTruthy(); }); - it('should initialize with random vacation numbers', () => { + it('should initialize with vacation days array', () => { const vacations = service.vacationNumberSignal(); - expect(vacations.cp).toBeGreaterThanOrEqual(1); - expect(vacations.cp).toBeLessThanOrEqual(9); - expect(vacations.rtt).toBeGreaterThanOrEqual(1); - expect(vacations.rtt).toBeLessThanOrEqual(9); - expect(vacations.other).toBeGreaterThanOrEqual(1); - expect(vacations.other).toBeLessThanOrEqual(9); + expect(Array.isArray(vacations)).toBe(true); + expect(vacations.length).toBeGreaterThan(0); + }); + + it('should have vacation days with valid properties', () => { + const vacations = service.vacationNumberSignal(); + vacations.forEach((day) => { + expect(day.id).toBeDefined(); + expect(day.type).toBeDefined(); + expect(day.numberOfDays).toBeGreaterThanOrEqual(1); + expect(day.numberOfDays).toBeLessThanOrEqual(9); + expect(day.expiryDate).toBeInstanceOf(Date); + }); }); it('should update vacation number signal', () => { - const newVacations = { cp: 5, rtt: 3, other: 2 }; + const newVacations: VacDay[] = [ + { + id: 'test-id', + type: SelectableDayType.CP, + numberOfDays: 5, + expiryDate: new Date(), + }, + ]; service.vacationNumberSignal.set(newVacations); expect(service.vacationNumberSignal()).toEqual(newVacations); }); + + it('should create a new vacation day', () => { + const newDay = service.createVacationDay(); + expect(newDay.id).toBeDefined(); + expect(newDay.type).toBe(SelectableDayType.CP); + expect(newDay.numberOfDays).toBe(1); + expect(newDay.expiryDate).toBeInstanceOf(Date); + }); }); ````