From 3bd6f1764732047841e132642e20496bc0add093 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Wed, 30 Sep 2020 21:38:21 +0100 Subject: Update tests with new FormListing props --- src/tests/components/FormListing.test.tsx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/tests/components/FormListing.test.tsx b/src/tests/components/FormListing.test.tsx index cb06201..4080f4d 100644 --- a/src/tests/components/FormListing.test.tsx +++ b/src/tests/components/FormListing.test.tsx @@ -3,28 +3,41 @@ import { render } from '@testing-library/react'; import FormListing from "../../components/FormListing"; import { BrowserRouter as Router } from 'react-router-dom'; +import { Form } from '../../api/forms'; + +const openFormListing: Form = { + title: "Example form listing", + description: "My form listing", + open: true +} + +const closedFormListing: Form = { + title: "Example form listing", + description: "My form listing", + open: false +} test('renders form listing with specified title', () => { - const { getByText } = render(); + const { getByText } = render(); const formListing = getByText(/Example form listing/i); expect(formListing).toBeInTheDocument(); }); test('renders form listing with specified description', () => { - const { getByText } = render(); + const { getByText } = render(); const formListing = getByText(/My form listing/i); expect(formListing).toBeInTheDocument(); }); test('renders form listing with background green colour for open', () => { - const { container } = render(); + const { container } = render(); const elem = container.querySelector("a"); 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 { container } = render(); const elem = container.querySelector("a"); const style = window.getComputedStyle(elem); expect(style.backgroundColor).toBe("rgb(44, 47, 51)"); -- cgit v1.2.3