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,
RouterTestingModule,
TranslateModule.forRoot(),
],
+ providers:[
+ CookieService,
+ MockBackend
+ ]
}).compileComponents();
})
);
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