OpenSlides/client/src/app/app.component.spec.ts
GabrielMeyer 376f4e2a31 Implements a mechanism for a fallback theme
- If the previously selected theme is not available the default OpenSlides theme will be displayed.
- Before the current selected theme was loaded, no theme is displayed.
2019-05-07 17:32:28 +02:00

34 lines
1.3 KiB
TypeScript

import { TestBed, async, fakeAsync, tick } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { E2EImportsModule } from './../e2e-imports.module';
import { ServertimeService } from './core/core-services/servertime.service';
import { TranslateService } from '@ngx-translate/core';
describe('AppComponent', () => {
let servertimeService, translate;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule]
}).compileComponents();
servertimeService = TestBed.get(ServertimeService);
translate = TestBed.get(TranslateService);
spyOn(servertimeService, 'startScheduler').and.stub();
spyOn(translate, 'addLangs').and.stub();
spyOn(translate, 'setDefaultLang').and.stub();
spyOn(translate, 'getBrowserLang').and.stub();
spyOn(translate, 'getLangs').and.returnValue([]);
spyOn(translate, 'use').and.stub();
}));
it('should create the app', fakeAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
tick(1000);
fixture.whenStable().then(() => {
expect(servertimeService.startScheduler).toHaveBeenCalled();
});
}));
});