summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-portal/src/app')
-rw-r--r--usecaseui-portal/src/app/app.component.spec.ts27
1 files changed, 18 insertions, 9 deletions
diff --git a/usecaseui-portal/src/app/app.component.spec.ts b/usecaseui-portal/src/app/app.component.spec.ts
index bcbdf36b..54f42b55 100644
--- a/usecaseui-portal/src/app/app.component.spec.ts
+++ b/usecaseui-portal/src/app/app.component.spec.ts
@@ -1,11 +1,24 @@
import { TestBed, async } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+import { NgZorroAntdModule } from 'ng-zorro-antd';
+import { TranslateModule, TranslateLoader, TranslateService, TranslateFakeLoader} from '@ngx-translate/core';
+
import { AppComponent } from './app.component';
+
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
+ imports: [
+ RouterTestingModule,
+ NgZorroAntdModule,
+ TranslateModule.forRoot({loader: { provide: TranslateLoader, useClass: TranslateFakeLoader }})
+ ],
+ providers: [
+ TranslateService
+ ]
}).compileComponents();
}));
it('should create the app', async(() => {
@@ -13,15 +26,11 @@ describe('AppComponent', () => {
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
- it(`should have as title 'app'`, async(() => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.debugElement.componentInstance;
- expect(app.title).toEqual('app');
- }));
- it('should render title in a h1 tag', async(() => {
+
+ it('should change Language', async(() => {
const fixture = TestBed.createComponent(AppComponent);
- fixture.detectChanges();
- const compiled = fixture.debugElement.nativeElement;
- expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
+ const component = fixture.debugElement.componentInstance;
+ component.changeLanguage("zh");
+ expect(component.selectLanguage).toBe("zh");
}));
});