summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2019-01-25 14:24:23 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2019-01-25 14:24:55 +0530
commitaa4eca9829469b6b233b7032a0687e9c95d41487 (patch)
treeefb7528a9a22326d5ae65a602517398328674611 /usecaseui-portal
parent0e9bd730c8e839144a77c81ec6f3482e18905778 (diff)
Test case -app component
Configured test bed for app component and added test case to cover the entire component. Issue-ID: USECASEUI-195 Change-Id: I68637596b4ee9b8af78ea2b0e3dcec7f4b7cda07 Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'usecaseui-portal')
-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");
}));
});