diff options
author | 2020-04-01 15:53:15 +0000 | |
---|---|---|
committer | 2020-04-01 15:53:15 +0000 | |
commit | 6e6d76601a5f0298829b1fafa8d3d497f7327fad (patch) | |
tree | d41b03ee37869d0d2b7a07e29eb7abea34f11178 | |
parent | fa8fd81b7076a7a2c52bcabf60a5ef71551d9cb0 (diff) | |
parent | 4fbe18cc05946aa2bca4747166313188b4bd9f55 (diff) |
Merge "test cases written in layout component"
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts index 6a2bb7ff..975f72c3 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts @@ -41,17 +41,17 @@ import { TranslateModule } from '@ngx-translate/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { LayoutComponent } from './layout.component'; import { LayoutModule } from './layout.module'; -import { MatDialog, MatDialogModule } from '@angular/material'; -import { Overlay } from '@angular/cdk/overlay'; +import { MatDialogModule } from '@angular/material'; import { CookieService } from 'ngx-cookie-service'; +import { MockBackend } from '@angular/http/testing'; describe('LayoutComponent', () => { let component: LayoutComponent; let fixture: ComponentFixture<LayoutComponent>; + let cookieService: CookieService; beforeEach( async(() => { TestBed.configureTestingModule({ - providers:[CookieService], imports: [ MatDialogModule, HttpClientTestingModule, @@ -59,6 +59,10 @@ describe('LayoutComponent', () => { RouterTestingModule, TranslateModule.forRoot(), ], + providers:[ + CookieService, + MockBackend + ] }).compileComponents(); }) ); @@ -67,15 +71,22 @@ describe('LayoutComponent', () => { fixture = TestBed.createComponent(LayoutComponent); component = fixture.componentInstance; fixture.detectChanges(); + cookieService = TestBed.get(CookieService); }); it('should create', () => { expect(component).toBeTruthy(); }); + it('testing if condition in ngOnInit method',()=>{ + component.cookieService.set('show_app_header','false'); + component.ngOnInit(); + expect(component.showHeader).toBe(false) + }) + it('should test receiveCollapsed method',()=>{ component.receiveCollapsed(true); expect(component.collapedSideBar).toBe(true); }) -}); +});
\ No newline at end of file |