aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/components')
-rw-r--r--src/tests/components/FormListing.test.tsx12
-rw-r--r--src/tests/components/HeaderBar.test.tsx23
2 files changed, 29 insertions, 6 deletions
diff --git a/src/tests/components/FormListing.test.tsx b/src/tests/components/FormListing.test.tsx
index ad76381..f071c33 100644
--- a/src/tests/components/FormListing.test.tsx
+++ b/src/tests/components/FormListing.test.tsx
@@ -17,9 +17,11 @@ const openFormListing: Form = {
"id": "my-question",
"name": "My question",
"type": QuestionType.ShortText,
- "data": {}
+ "data": {},
+ required: false
}
- ]
+ ],
+ webhook: null
};
const closedFormListing: Form = {
@@ -32,9 +34,11 @@ const closedFormListing: Form = {
"id": "what-should-i-ask",
"name": "What should I ask?",
"type": QuestionType.ShortText,
- "data": {}
+ "data": {},
+ required: false
}
- ]
+ ],
+ webhook: null
};
test("renders form listing with specified title", () => {
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();
+});