+
+ expect(dialogRefSpy.close).toHaveBeenCalledWith("ok");
+ });
+
+ it("should not close dialog when error from server", async () => {
+ let submitButton: MatButtonHarness = await loader.getHarness(
+ MatButtonHarness.with({ selector: "#submitButton" })
+ );
+
+ const errorResponse = {
+ status: 400,
+ statusText: "Bad Request",
+ } as HttpErrorResponse;
+ policyServiceSpy.putPolicy.and.returnValue(errorResponse);
+
+ await submitButton.click();
+
+ expect(policyServiceSpy.putPolicy).toHaveBeenCalled();
+
+ expect(dialogRefSpy.close).not.toHaveBeenCalled();