aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2021-02-02 22:23:21 +0000
committerGravatar GitHub <[email protected]>2021-02-02 22:23:21 +0000
commit675749db4380317f3fe9f98710656b8a4a6787fd (patch)
treef8eeb3ec4ea70e3061754857267def7ab7ea7841 /src/tests
parentMerge pull request #110 from python-discord/dependabot/npm_and_yarn/eslint-7.... (diff)
parentRevert "Updates License year" (diff)
Merge pull request #107 from python-discord/repo-cleanup
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/components/FormListing.test.tsx16
1 files changed, 12 insertions, 4 deletions
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)");
+ }
});