UI improvments

This commit is contained in:
nessar committed 2026-10-02 15:05:30 +02:00
1 parent c9dbe82b79
commit 0ce33cc9d6
106 files changed
+72934 -1675

No files matched your search

+18 -2
View File
@@ -2,6 +2,7 @@ import { TestBed } from '@angular/core/testing';
import { provideZonelessChangeDetection } from '@angular/core';
import { UserInputService } from './user-input-service';
import { SelectableDayType, VacDay } from './calendar-service';
import { vi } from 'vitest';
describe('UserInputService', () => {
let service: UserInputService;
@@ -13,6 +14,8 @@ describe('UserInputService', () => {
service = TestBed.inject(UserInputService);
});
afterEach(() => vi.restoreAllMocks());
it('should be created', () => {
expect(service).toBeTruthy();
});
@@ -28,12 +31,25 @@ describe('UserInputService', () => {
vacations.forEach((day) => {
expect(day.id).toBeDefined();
expect(day.type).toBeDefined();
expect(day.numberOfDays).toBeGreaterThanOrEqual(1);
expect(day.numberOfDays).toBeLessThanOrEqual(9);
expect(day.numberOfDays).toBeGreaterThanOrEqual(10);
expect(day.numberOfDays).toBeLessThanOrEqual(20);
expect(day.expiryDate).toBeInstanceOf(Date);
});
});
it.each([
[0, 10],
[1 - Number.EPSILON, 20],
])('starts every balance at %s random draw with %s days', (draw, expected) => {
vi.spyOn(Math, 'random').mockReturnValue(draw);
const initialBalances = new UserInputService().vacationNumberSignal();
expect(initialBalances.map((balance) => balance.numberOfDays)).toEqual([
expected,
expected,
expected,
]);
});
it('should update vacation number signal', () => {
const newVacations: VacDay[] = [
{