diff --git a/debug.log b/debug.log new file mode 100644 index 00000000..16d82dbf --- /dev/null +++ b/debug.log @@ -0,0 +1 @@ +[1109/003452.026:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) diff --git a/src/app/components/project-map/console-wrapper/console-wrapper.component.spec.ts b/src/app/components/project-map/console-wrapper/console-wrapper.component.spec.ts index e69de29b..3092f0e6 100644 --- a/src/app/components/project-map/console-wrapper/console-wrapper.component.spec.ts +++ b/src/app/components/project-map/console-wrapper/console-wrapper.component.spec.ts @@ -0,0 +1,33 @@ +import { ConsoleWrapperComponent } from "./console-wrapper.component"; +import { NodeConsoleService } from '../../../services/nodeConsole.service'; +import { ThemeService } from '../../../services/theme.service'; +import { MapSettingsService } from '../../../services/mapsettings.service'; + +describe('ConsoleWrapperComponent', () => { + it('should get actual theme', () => { + const consoleService = new NodeConsoleService(); + + const themeService = autoSpy(ThemeService); + themeService.getActualTheme.and.returnValue('light'); + + const mapSettingsService = autoSpy(MapSettingsService); + const component = new ConsoleWrapperComponent(consoleService, themeService, mapSettingsService); + + component.ngOnInit(); + + expect(component.isLightThemeEnabled).toBe(true); + }); +}); + +export type SpyOf = T & { [k in keyof T]: jasmine.Spy }; + +export function autoSpy(obj: new (...args: any[]) => T): SpyOf { + const res: SpyOf = {} as any; + + const keys = Object.getOwnPropertyNames(obj.prototype); + keys.forEach((key) => { + res[key] = jasmine.createSpy(key); + }); + + return res; +} diff --git a/src/app/components/project-map/context-console-menu/context-console-menu.component.spec.ts b/src/app/components/project-map/context-console-menu/context-console-menu.component.spec.ts index ee472584..a6628824 100644 --- a/src/app/components/project-map/context-console-menu/context-console-menu.component.spec.ts +++ b/src/app/components/project-map/context-console-menu/context-console-menu.component.spec.ts @@ -17,7 +17,7 @@ import { Node } from '../../../cartography/models/node'; import { ConsoleDeviceActionComponent } from '../context-menu/actions/console-device-action/console-device-action.component'; import { ConsoleDeviceActionBrowserComponent } from '../context-menu/actions/console-device-action-browser/console-device-action-browser.component'; -fdescribe('ContextConsoleMenuComponent', () => { +describe('ContextConsoleMenuComponent', () => { let component: ContextConsoleMenuComponent; let fixture: ComponentFixture; let toasterService: MockedToasterService = new MockedToasterService(); diff --git a/src/app/components/project-map/log-console/log-console.component.spec.ts b/src/app/components/project-map/log-console/log-console.component.spec.ts index 81b78f7d..35d5d552 100644 --- a/src/app/components/project-map/log-console/log-console.component.spec.ts +++ b/src/app/components/project-map/log-console/log-console.component.spec.ts @@ -76,7 +76,7 @@ describe('LogConsoleComponent', () => { component.handleCommand(); - expect(component.showMessage).toHaveBeenCalledWith({type: 'command', message: 'Current version: 2020.3.0-beta.4'}); + expect(component.showMessage).toHaveBeenCalledWith({type: 'command', message: 'Current version: 2.2.16'}); }); it('should call show message when unknown command entered', () => { diff --git a/src/app/components/settings/settings.component.spec.ts b/src/app/components/settings/settings.component.spec.ts index 192c4d60..65f16d90 100644 --- a/src/app/components/settings/settings.component.spec.ts +++ b/src/app/components/settings/settings.component.spec.ts @@ -15,6 +15,8 @@ import { ToasterService } from '../../services/toaster.service'; import { MockedToasterService } from '../../services/toaster.service.spec'; import { ConsoleService } from '../../services/settings/console.service'; import { MapSettingsService } from '../../services/mapsettings.service'; +import { UpdatesService } from '../../services/updates.service'; +import { autoSpy } from '../project-map/console-wrapper/console-wrapper.component.spec'; describe('SettingsComponent', () => { let component: SettingsComponent; @@ -25,6 +27,7 @@ describe('SettingsComponent', () => { toggleIntegrateInterfaceLabels(val: boolean) {} }; let consoleService; + let updatesService = autoSpy(UpdatesService); beforeEach(async(() => { consoleService = { @@ -37,7 +40,8 @@ describe('SettingsComponent', () => { SettingsService, { provide: ToasterService, useClass: MockedToasterService }, { provide: ConsoleService, useValue: consoleService }, - { provide: MapSettingsService, useValue: mapSettingsService } + { provide: MapSettingsService, useValue: mapSettingsService }, + { provide: UpdatesService, useValue: updatesService } ], declarations: [SettingsComponent] }).compileComponents(); diff --git a/src/app/services/server.service.spec.ts b/src/app/services/server.service.spec.ts index 230006f0..c3a15fb3 100644 --- a/src/app/services/server.service.spec.ts +++ b/src/app/services/server.service.spec.ts @@ -150,6 +150,7 @@ describe('ServerService', () => { expectedServer.host = 'hostname'; expectedServer.port = 9999; expectedServer.location = 'bundled'; + expectedServer.protocol = 'http:'; service.getLocalServer('hostname', 9999).then(() => { expect(service.create).toHaveBeenCalledWith(expectedServer);