+ it("should close instance tables when clicking on refresh button", async () => {
+ let refreshButton: MatButtonHarness = await loader.getHarness(
+ MatButtonHarness.with({ selector: "#refreshButton" })
+ );
+ const policyTypeComponent: PolicyTypeComponent = hostFixture.debugElement.query(
+ By.directive(PolicyTypeComponent)
+ ).componentInstance;
+ let booleanTrigger = policyTypeComponent.minimiseTrigger
+ await refreshButton.click();
+ expect(policyTypeComponent.minimiseTrigger).not.toEqual(booleanTrigger);
+ })
+
+ it("should render the types sorted when clicking on refresh button", async () => {
+ const typeComponents: PolicyTypeComponent[] = hostFixture.debugElement
+ .queryAll(By.directive(PolicyTypeComponent))
+ .map((component) => component.componentInstance);
+
+ for(var i= 0; i < typeComponents.length-1; i++){
+ expect(typeComponents[i].policyTypeId<typeComponents[i+1].policyTypeId).toBeTruthy();
+ }
+ })
+ })
+
+ describe("no types", () => {
+ beforeEach(() => {
+ policyServiceSpy.getPolicyTypes.and.returnValue(
+ of({
+ policytype_ids: [],
+ } as PolicyTypes)
+ );
+
+ compileAndGetComponents();
+ });
+
+ it("should display message of no types", async () => {
+ expect(policyServiceSpy.getPolicyTypes.length).toEqual(0);
+ const content = el.query(By.css('#noInstance')).nativeElement;
+ expect(content.innerText).toBe("There are no policy types to display.");
+ });