aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-01-04 02:29:27 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-01-04 04:02:28 +0300
commitd2cc29d22203cfea0adc61ceaa72ba936070045a (patch)
tree3860c3052b44f9bc04ac82a18aa7f36f84ac9b3b /src/tests
parentImplements Form Fetching (diff)
Updates HeaderBar
Changes header bar component to accept a description, and render it properly on different screens. Additionally adds a button to return to the home page. Updates tests. Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/components/HeaderBar.test.tsx23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/tests/components/HeaderBar.test.tsx b/src/tests/components/HeaderBar.test.tsx
index 9c232ad..dd77c8b 100644
--- a/src/tests/components/HeaderBar.test.tsx
+++ b/src/tests/components/HeaderBar.test.tsx
@@ -2,16 +2,35 @@ import React from "react";
import { render } from "@testing-library/react";
import "@testing-library/jest-dom/extend-expect";
import HeaderBar from "../../components/HeaderBar";
+import { MemoryRouter } from "react-router-dom";
test("renders header bar with title", () => {
- const { getByText } = render(<HeaderBar />);
+ const { getByText } = render(<MemoryRouter><HeaderBar /></MemoryRouter>);
const formListing = getByText(/Python Discord Forms/i);
expect(formListing).toBeInTheDocument();
});
test("renders header bar with custom title", () => {
- const { getByText } = render(<HeaderBar title="Testing title"/>);
+ const { getByText } = render(<MemoryRouter><HeaderBar title="Testing title"/></MemoryRouter>);
const formListing = getByText(/Testing title/i);
expect(formListing).toBeInTheDocument();
});
+test("renders header bar with custom description", () => {
+ const { getByText } = render(<MemoryRouter><HeaderBar description="Testing description"/></MemoryRouter>);
+ const formListing = getByText(/Testing description/i);
+ expect(formListing).toBeInTheDocument();
+});
+
+test("renders header bar with custom title and description", () => {
+ const { getByText } = render(
+ <MemoryRouter>
+ <HeaderBar title="Testing Title" description="Testing description"/>
+ </MemoryRouter>
+ );
+
+ const title = getByText(/Testing title/i);
+ const description = getByText(/Testing description/i);
+ expect(title).toBeInTheDocument();
+ expect(description).toBeInTheDocument();
+});