From d2cc29d22203cfea0adc61ceaa72ba936070045a Mon Sep 17 00:00:00 2001
From: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com>
Date: Mon, 4 Jan 2021 02:29:27 +0300
Subject: 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 <47495861+HassanAbouelela@users.noreply.github.com>
---
 src/tests/components/HeaderBar.test.tsx | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

(limited to 'src/tests/components/HeaderBar.test.tsx')

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();
+});
-- 
cgit v1.2.3

