Update settings.component.spec.ts

This commit is contained in:
piotrpekala7 2021-05-11 18:16:20 +02:00
parent cf2f0e3110
commit 748997c635

View File

@ -23,6 +23,7 @@ describe('SettingsComponent', () => {
let mapSettingsService = { let mapSettingsService = {
integrateLinkLabelsToLinks: true, integrateLinkLabelsToLinks: true,
toggleIntegrateInterfaceLabels(val: boolean) {}, toggleIntegrateInterfaceLabels(val: boolean) {},
toggleOpenConsolesInWidget(val: boolean) {}
}; };
let consoleService; let consoleService;
let updatesService = autoSpy(UpdatesService); let updatesService = autoSpy(UpdatesService);
@ -75,11 +76,19 @@ describe('SettingsComponent', () => {
}; };
const getAll = spyOn(settingsService, 'getAll').and.returnValue(settings); const getAll = spyOn(settingsService, 'getAll').and.returnValue(settings);
const setAll = spyOn(settingsService, 'setAll'); const setAll = spyOn(settingsService, 'setAll');
spyOn(mapSettingsService, 'toggleIntegrateInterfaceLabels');
spyOn(mapSettingsService, 'toggleOpenConsolesInWidget');
component.ngOnInit(); component.ngOnInit();
expect(getAll).toHaveBeenCalled(); expect(getAll).toHaveBeenCalled();
expect(component.settings).toEqual(settings); expect(component.settings).toEqual(settings);
component.settings.crash_reports = false; component.settings.crash_reports = false;
component.save(); component.save();
expect(setAll).toHaveBeenCalledWith(settings); expect(setAll).toHaveBeenCalledWith(settings);
expect(mapSettingsService.toggleIntegrateInterfaceLabels).toHaveBeenCalled();
expect(mapSettingsService.toggleOpenConsolesInWidget).toHaveBeenCalled();
}); });
}); });