aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/components/HeaderBar.test.tsx
blob: 2cf96acca05b4c5bcfd6d4fee9b49c9f976c82cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React from "react";
import { render } from "@testing-library/react";
import HeaderBar from "../../components/HeaderBar";
import { MemoryRouter } from "react-router-dom";

test("renders header bar with title", () => {
    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(<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();
});