import { LinearWorkflowSectionComponent } from './linear-workflow-section.component'; import { LinearWorkflowComponent } from './linear-workflow.component'; import Spy = jasmine.Spy; describe("LinearWorkflowSectionComponent", () => { var component: LinearWorkflowSectionComponent; var parentMock: LinearWorkflowComponent; beforeEach(() => { component = new LinearWorkflowSectionComponent(); parentMock = new LinearWorkflowComponent(); component.parent = parentMock; }); describe("$onInit", () => { it("calls parent component to add itself as a section", () => { var addSectionSpy: Spy = spyOn(parentMock, "addSection").and.returnValue(null); component.$onInit(); expect(addSectionSpy.calls.argsFor(0)[0]).toBe(component); }); }); });