From dc86560fd0a0c111bfde85189ab5a9421ceb1365 Mon Sep 17 00:00:00 2001
From: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com>
Date: Tue, 26 Jan 2021 12:23:52 +0300
Subject: Cleans Up Some Warnings
Makes slight modifications to handle some minor warnings.
Signed-off-by: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com>
---
src/tests/components/FormListing.test.tsx | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
(limited to 'src/tests')
diff --git a/src/tests/components/FormListing.test.tsx b/src/tests/components/FormListing.test.tsx
index f071c33..f269dbf 100644
--- a/src/tests/components/FormListing.test.tsx
+++ b/src/tests/components/FormListing.test.tsx
@@ -56,13 +56,21 @@ test("renders form listing with specified description", () => {
test("renders form listing with background green colour for open", () => {
const { container } = render();
const elem = container.querySelector("a");
- const style = window.getComputedStyle(elem);
- expect(style.backgroundColor).toBe("rgb(67, 181, 129)");
+ expect(elem).not.toBeNull();
+
+ if (elem) {
+ const style = window.getComputedStyle(elem);
+ expect(style.backgroundColor).toBe("rgb(67, 181, 129)");
+ }
});
test("renders form listing with background dark colour for closed", () => {
const { container } = render();
const elem = container.querySelector("a");
- const style = window.getComputedStyle(elem);
- expect(style.backgroundColor).toBe("rgb(44, 47, 51)");
+ expect(elem).not.toBeNull();
+
+ if (elem) {
+ const style = window.getComputedStyle(elem);
+ expect(style.backgroundColor).toBe("rgb(44, 47, 51)");
+ }
});
--
cgit v1.2.3