From 3f52b60a0e0ae40bb3a473d583fb342587bf87d6 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 17 Nov 2022 08:01:14 -0500 Subject: [PATCH] Update tests Signed-off-by: Sebastian Malton --- src/renderer/components/icon/icon.test.tsx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/icon/icon.test.tsx b/src/renderer/components/icon/icon.test.tsx index fc61620083..f927caa7da 100644 --- a/src/renderer/components/icon/icon.test.tsx +++ b/src/renderer/components/icon/icon.test.tsx @@ -39,7 +39,11 @@ describe(" href technical tests", () => { /> )); - expect(result.queryByTestId("my-icon")).toBeInTheDocument(); + const icon = result.queryByTestId("my-icon"); + + expect(icon).toBeInTheDocument(); + expect(icon).toHaveAttribute("href", "http://localhost"); + expect(logger.warn).not.toBeCalled(); }); it("should render an with https href", () => { @@ -50,7 +54,11 @@ describe(" href technical tests", () => { /> )); - expect(result.queryByTestId("my-icon")).toBeInTheDocument(); + const icon = result.queryByTestId("my-icon"); + + expect(icon).toBeInTheDocument(); + expect(icon).toHaveAttribute("href", "https://localhost"); + expect(logger.warn).not.toBeCalled(); }); it("should warn about ws hrefs", () => { @@ -61,7 +69,10 @@ describe(" href technical tests", () => { /> )); - expect(result.queryByTestId("my-icon")).not.toBeInTheDocument(); + const icon = result.queryByTestId("my-icon"); + + expect(icon).toBeInTheDocument(); + expect(icon).not.toHaveAttribute("href", "ws://localhost"); expect(logger.warn).toBeCalled(); }); @@ -73,7 +84,10 @@ describe(" href technical tests", () => { /> )); - expect(result.queryByTestId("my-icon")).not.toBeInTheDocument(); + const icon = result.queryByTestId("my-icon"); + + expect(icon).toBeInTheDocument(); + expect(icon).not.toHaveAttribute("href", "javascript:void 0"); expect(logger.warn).toBeCalled(); }); });