1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import { TestBed, async, fakeAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TranslateModule, TranslateLoader, TranslateService, TranslateFakeLoader} from '@ngx-translate/core';
import {HomesService} from "./core/services/homes.service";
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(fakeAsync(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
imports: [
RouterTestingModule,
HttpClientTestingModule,
NgZorroAntdModule,
TranslateModule.forRoot({loader: { provide: TranslateLoader, useClass: TranslateFakeLoader }})
],
providers: [
TranslateService,
HomesService
]
}).compileComponents();
}));
it('should create the app', fakeAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it('should change Language', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const component = fixture.debugElement.componentInstance;
// component.changeLanguage("zh");
// expect(component.selectLanguage).toBe("zh");
}));
});
|