Add comprehensive tests for vac-optimizer application
Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com>
This commit is contained in:
1 parent
f99db8b82d
commit
80a588741b
16 files changed
+385
-37
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { CalendarMonth } from './calendar-month';
|
||||
|
||||
describe('CalendarMonth', () => {
|
||||
@@ -8,7 +8,8 @@ describe('CalendarMonth', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CalendarMonth]
|
||||
imports: [CalendarMonth],
|
||||
providers: [provideZonelessChangeDetection()]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { CalendarSettings } from './calendar-settings';
|
||||
|
||||
describe('CalendarSettings', () => {
|
||||
@@ -8,7 +8,8 @@ describe('CalendarSettings', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CalendarSettings]
|
||||
imports: [CalendarSettings],
|
||||
providers: [provideZonelessChangeDetection()]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { CalendarYear } from './calendar-year';
|
||||
|
||||
describe('CalendarYear', () => {
|
||||
@@ -8,7 +8,8 @@ describe('CalendarYear', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CalendarYear]
|
||||
imports: [CalendarYear],
|
||||
providers: [provideZonelessChangeDetection()]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ export class CalendarYear {
|
||||
this.selectedDates.optimizeVacations(
|
||||
{ ...vacationData },
|
||||
this.calendarSettingsService,
|
||||
this.calendarService,
|
||||
);
|
||||
}
|
||||
this.isLoading.set(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { DarkLightModeButton } from './dark-light-mode-button';
|
||||
|
||||
describe('DarkLightModeButton', () => {
|
||||
@@ -9,6 +9,7 @@ describe('DarkLightModeButton', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [DarkLightModeButton],
|
||||
providers: [provideZonelessChangeDetection()],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(DarkLightModeButton);
|
||||
|
||||
+21
-2
@@ -1,5 +1,6 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { MatDialogRef } from '@angular/material/dialog';
|
||||
import { CalendarSettingsDialog } from './calendar-settings-dialog';
|
||||
|
||||
describe('CalendarSettingsDialog', () => {
|
||||
@@ -8,7 +9,16 @@ describe('CalendarSettingsDialog', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CalendarSettingsDialog]
|
||||
imports: [CalendarSettingsDialog],
|
||||
providers: [
|
||||
provideZonelessChangeDetection(),
|
||||
{
|
||||
provide: MatDialogRef,
|
||||
useValue: {
|
||||
close: jasmine.createSpy('close')
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
@@ -20,4 +30,13 @@ describe('CalendarSettingsDialog', () => {
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should have calendar settings service', () => {
|
||||
expect(component['calendarSettingsService']).toBeDefined();
|
||||
});
|
||||
|
||||
it('should close dialog when closeDialog is called', () => {
|
||||
component.closeDialog();
|
||||
expect(component.dialogRef.close).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { UserInput } from './user-input';
|
||||
|
||||
describe('UserInput', () => {
|
||||
@@ -8,7 +8,8 @@ describe('UserInput', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [UserInput]
|
||||
imports: [UserInput],
|
||||
providers: [provideZonelessChangeDetection()]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
@@ -20,4 +21,21 @@ describe('UserInput', () => {
|
||||
it('should create', () => {
|
||||
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 have valid form controls', () => {
|
||||
const cpControl = component.userInputForm.get('CP');
|
||||
const rttControl = component.userInputForm.get('RTT');
|
||||
const othersControl = component.userInputForm.get('Others');
|
||||
|
||||
expect(cpControl).toBeTruthy();
|
||||
expect(rttControl).toBeTruthy();
|
||||
expect(othersControl).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { UserSettings } from './user-settings';
|
||||
|
||||
describe('UserSettings', () => {
|
||||
@@ -8,7 +8,8 @@ describe('UserSettings', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [UserSettings]
|
||||
imports: [UserSettings],
|
||||
providers: [provideZonelessChangeDetection()]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
||||
Reference in new issue
Block a user