2019-07-26 11:46:59 +02:00
|
|
|
import { async, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
|
|
|
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
|
|
|
2018-06-13 18:34:10 +02:00
|
|
|
import { AppComponent } from './app.component';
|
2018-09-02 11:05:09 +02:00
|
|
|
import { E2EImportsModule } from './../e2e-imports.module';
|
2019-01-31 13:40:27 +01:00
|
|
|
import { ServertimeService } from './core/core-services/servertime.service';
|
2019-01-24 16:25:50 +01:00
|
|
|
|
2018-06-13 18:34:10 +02:00
|
|
|
describe('AppComponent', () => {
|
2019-03-06 07:38:43 +01:00
|
|
|
let servertimeService, translate;
|
2019-01-24 16:25:50 +01:00
|
|
|
|
2018-06-19 16:55:50 +02:00
|
|
|
beforeEach(async(() => {
|
|
|
|
TestBed.configureTestingModule({
|
2018-09-02 11:05:09 +02:00
|
|
|
imports: [E2EImportsModule]
|
2018-06-19 16:55:50 +02:00
|
|
|
}).compileComponents();
|
2019-01-24 16:25:50 +01:00
|
|
|
|
|
|
|
servertimeService = TestBed.get(ServertimeService);
|
2019-03-06 07:38:43 +01:00
|
|
|
translate = TestBed.get(TranslateService);
|
2019-01-24 16:25:50 +01:00
|
|
|
spyOn(servertimeService, 'startScheduler').and.stub();
|
2019-03-06 07:38:43 +01:00
|
|
|
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();
|
2018-06-19 16:55:50 +02:00
|
|
|
}));
|
2019-03-06 07:38:43 +01:00
|
|
|
it('should create the app', fakeAsync(() => {
|
2018-06-19 16:55:50 +02:00
|
|
|
const fixture = TestBed.createComponent(AppComponent);
|
|
|
|
const app = fixture.debugElement.componentInstance;
|
|
|
|
expect(app).toBeTruthy();
|
2019-04-08 10:57:43 +02:00
|
|
|
tick(1000);
|
2019-03-06 07:38:43 +01:00
|
|
|
fixture.whenStable().then(() => {
|
|
|
|
expect(servertimeService.startScheduler).toHaveBeenCalled();
|
|
|
|
});
|
2018-06-19 16:55:50 +02:00
|
|
|
}));
|
2018-06-13 18:34:10 +02:00
|
|
|
});
|