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"); })); });