diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 47c8a9a02..9da315e03 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -24,7 +24,6 @@ import { Router } from '@angular/router'; import { ChannelStore } from './state'; import { STORE_KEY } from './shared/enums/store-keys.enum'; import { WhatsNewServiceStub } from './services/whats-new.service.stub'; -import { IpcCommand } from '../../shared/ipc-command.class'; jest.mock('custom-electron-titlebar', () => { return { diff --git a/src/app/settings/settings.component.spec.ts b/src/app/settings/settings.component.spec.ts index f3a9a8b53..4b41143bc 100644 --- a/src/app/settings/settings.component.spec.ts +++ b/src/app/settings/settings.component.spec.ts @@ -41,8 +41,8 @@ const DEFAULT_SETTINGS = { epgUrl: '', language: Language.ENGLISH, showCaptions: false, - theme: Theme.LightTheme -} + theme: Theme.LightTheme, +}; describe('SettingsComponent', () => { let component: SettingsComponent; @@ -106,13 +106,13 @@ describe('SettingsComponent', () => { }); describe('Get and set settings on component init', () => { - const settings = {player: 'test', showCaptions: true}; + const settings = { player: 'test', showCaptions: true }; let spyOnStorageGet; - + beforeEach(() => { spyOnStorageGet = spyOn(storage, 'get'); - }) - + }); + it('should init default settings if previous config was not saved', () => { spyOnStorageGet.and.returnValue(of(null)); spyOn(component.settingsForm, 'setValue'); @@ -133,38 +133,43 @@ describe('SettingsComponent', () => { spyOnStorageGet.and.returnValue(of(settings)); component.ngOnInit(); expect(storage.get).toHaveBeenCalled(); - expect(component.settingsForm.value).toEqual({...DEFAULT_SETTINGS, ...settings}); + expect(component.settingsForm.value).toEqual({ + ...DEFAULT_SETTINGS, + ...settings, + }); }); }); - - describe.only('Version check', () => { + describe('Version check', () => { const latestVersion = '1.0.0'; const currentVersion = '0.1.0'; - + it('should return true if version is outdated', () => { - spyOn(electronService, 'getAppVersion').and.returnValue(currentVersion); - const isOutdated = component.isCurrentVersionOutdated(latestVersion); + spyOn(electronService, 'getAppVersion').and.returnValue( + currentVersion + ); + const isOutdated = + component.isCurrentVersionOutdated(latestVersion); expect(isOutdated).toBeTruthy(); }); it('should update notification message if version is outdated', () => { spyOn(translate, 'instant'); - spyOn(electronService, 'getAppVersion').and.returnValue(currentVersion); + spyOn(electronService, 'getAppVersion').and.returnValue( + currentVersion + ); component.showVersionInformation(currentVersion); fixture.detectChanges(); expect(translate.instant).toHaveBeenCalled(); }); - }); it('should send epg fetch command', () => { spyOn(electronService, 'sendIpcEvent'); component.fetchEpg(); - expect(electronService.sendIpcEvent).toHaveBeenCalledWith( - EPG_FETCH, - { url: '' } - ); + expect(electronService.sendIpcEvent).toHaveBeenCalledWith(EPG_FETCH, { + url: '', + }); }); it('should navigate back to home page', () => { diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index dc8fac85c..40d269b41 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -4,7 +4,7 @@ import { FormGroup, FormBuilder } from '@angular/forms'; import { StorageMap } from '@ngx-pwa/local-storage'; import { Router } from '@angular/router'; import { MatSnackBar } from '@angular/material/snack-bar'; -import { Observable, Subscription } from 'rxjs'; +import { Observable } from 'rxjs'; import { STORE_KEY } from '../shared/enums/store-keys.enum'; import { Settings, VideoPlayer } from './settings.interface'; import { HttpClient } from '@angular/common/http';