import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
+import { CommonModule } from '@angular/common';
describe('MainComponentComponent', () => {
let component: HeaderTabsComponent;
let fixture: ComponentFixture<HeaderTabsComponent>;
+
beforeEach(async(() => {
TestBed.configureTestingModule({
fixture = TestBed.createComponent(HeaderTabsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+
+ it('should test if condition in ngOnInit method',()=>{
+ component.reportId = ""
+ component.reportMode=""
+ component.ngOnInit();
+ expect(component.finalReportId).toEqual("-1");
+ expect(component.repMode).toEqual("Create");
+ expect(component.reportId).toEqual("-1");
+ expect(component.reportMode).toEqual("Create");
+ });
+
+ it('should test else condition in ngOnInit method',()=>{
+ component.reportId="Indrijeet";
+ component.reportMode="kumar";
+ component.ngOnInit();
+ expect(component.finalReportId).toEqual(component.reportId);
+ });
+
+ it('should test if condition in ngAfterViewInit method',()=>{
+ component.reportId = "";
+ component.reportMode="";
+ component.ngAfterViewInit();
+ expect(component.finalReportId).toEqual("-1");
+ expect(component.repMode).toEqual("Create");
+ expect(component.reportId).toEqual("-1");
+ expect(component.reportMode).toEqual("Create");
+ });
+
+ it('should test else condition in ngAfterViewInit method',()=>{
+ component.reportId="indrijeet";
+ component.reportMode="kumar";
+ component.ngAfterViewInit();
+ expect(component.finalReportId).toEqual(component.reportId)
+ expect(component.repMode).toEqual(component.reportMode)
+ });
+
+ it('should test ngDoCheck method',()=>{
+ component.ngDoCheck();
+ console.log(component.tabChanged);
+ })
});