aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-01-26 12:23:52 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-01-26 12:26:12 +0300
commitdc86560fd0a0c111bfde85189ab5a9421ceb1365 (patch)
tree926dc7b6e4f9fa98aef6794c236fc9041b0d1922
parentAdds Apple Touch Icon (diff)
Cleans Up Some Warnings
Makes slight modifications to handle some minor warnings. Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r--src/pages/LandingPage.tsx2
-rw-r--r--src/setupTests.ts1
-rw-r--r--src/tests/components/FormListing.test.tsx16
3 files changed, 13 insertions, 6 deletions
diff --git a/src/pages/LandingPage.tsx b/src/pages/LandingPage.tsx
index af968ad..06fef46 100644
--- a/src/pages/LandingPage.tsx
+++ b/src/pages/LandingPage.tsx
@@ -17,7 +17,7 @@ function LandingPage(): JSX.Element {
const fetchForms = async () => {
setForms(await getForms());
};
- fetchForms();
+ fetchForms().then();
}, []);
if (!forms) {
diff --git a/src/setupTests.ts b/src/setupTests.ts
index 5018a42..6a69409 100644
--- a/src/setupTests.ts
+++ b/src/setupTests.ts
@@ -1,2 +1 @@
-
import "@testing-library/jest-dom/extend-expect";
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(<Router><FormListing form={openFormListing} /></Router>);
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(<Router><FormListing form={closedFormListing} /></Router>);
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)");
+ }
});