Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

import { HiHealthCareConditionInfoComponent } from './hi-health-care-condition-info.component';
import { EwvViewerService } from '../../ewv-viewer/ewv-viewer.service';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';

describe('HiHealthCareConditionInfoComponent', () => {
let component: HiHealthCareConditionInfoComponent;
let ewvViewerService: EwvViewerService;

beforeEach(() => {
ewvViewerService = new EwvViewerService(null, null);
component = new HiHealthCareConditionInfoComponent(ewvViewerService);
});

it('should be created', () => {
expect(component).toBeTruthy(); // Expects component to be created
});

it('test ngAfterViewInit method: "component.data" is defined', () => {
component.data = { };
expect(component.tableSettings.pagination).toEqual(true);
spyOn(component, 'populateData');

component.ngAfterViewInit();

expect(component.tableSettings.pagination).toEqual(false);
expect(component.populateData).toHaveBeenCalled();
});

it('test populateData method', () => {
component.data = {
procedureCodesInfo: {
procedureCodes: []
}
};
ewvViewerService.isSplitView = new BehaviorSubject<boolean>(false);
expect(component.isSplitView).toEqual(undefined);

component.populateData();

expect(component.isSplitView).toEqual(false);
});

it('test ngOnChanges method', () => {
spyOn(component, 'populateData');
expect(component.data).toEqual(undefined);

let changes;
changes = {
data: {
currentValue: null
}
};

component.ngOnChanges(changes);

expect(component.data).toEqual(null);
expect(component.populateData).not.toHaveBeenCalled();
});

it('test ngOnDestroy method', () => {
spyOn(component.collapseStateSubscription, 'unsubscribe');
spyOn(component.isSplitSubscription, 'unsubscribe');

component.ngOnDestroy();

expect(component.collapseStateSubscription.unsubscribe).toHaveBeenCalled();
expect(component.isSplitSubscription.unsubscribe).toHaveBeenCalled();
});
});