Add 404 page

This commit is contained in:
jwu-fisker
2021-01-07 21:34:39 -08:00
parent d2d7638e81
commit ab0453c09b
4 changed files with 73 additions and 9 deletions

View File

@@ -19,28 +19,27 @@ const renderRoute = async (route) => {
describe("App", () => {
it("Route / unauthenticated", async () => {
afterEach(() => {
setToken(null);
cleanup();
});
it("Route / unauthenticated", async () => {
const container = await renderRoute("/");
expect(container.querySelector("h1").innerHTML).toEqual("Sign in");
expect(container).toMatchSnapshot();
cleanup();
});
it("Route /signup unauthenticated", async () => {
setToken(null);
const container = await renderRoute("/signup");
expect(container.querySelector("h1").innerHTML).toEqual("Sign up");
expect(container).toMatchSnapshot();
cleanup();
});
it("Route /home unauthenticated", async () => {
setToken(null);
const container = await renderRoute("/home");
expect(container.querySelector("h1").innerHTML).toEqual("Sign in");
expect(container).toMatchSnapshot();
cleanup();
});
it("Route / authenticated", async () => {
@@ -48,7 +47,6 @@ describe("App", () => {
const container = await renderRoute("/");
expect(container.querySelector("h1").innerHTML).toEqual("Upload file");
expect(container).toMatchSnapshot();
cleanup();
});
it("Route /signup authenticated", async () => {
@@ -56,7 +54,6 @@ describe("App", () => {
const container = await renderRoute("/signup");
expect(container.querySelector("h1").innerHTML).toEqual("Upload file");
expect(container).toMatchSnapshot();
cleanup();
});
it("Route /home authenticated", async () => {
@@ -64,7 +61,19 @@ describe("App", () => {
const container = await renderRoute("/home");
expect(container.querySelector("h1").innerHTML).toEqual("Upload file");
expect(container).toMatchSnapshot();
cleanup();
});
it("Route /page-not-found unauthenticated", async () => {
const container = await renderRoute("/page-not-found");
expect(container.querySelector("h1").innerHTML).toEqual("Page Not Found");
expect(container).toMatchSnapshot();
});
it("Route /page-not-found authenticated", async () => {
setToken(TEST_TOKEN);
const container = await renderRoute("/page-not-found");
expect(container.querySelector("h1").innerHTML).toEqual("Page Not Found");
expect(container).toMatchSnapshot();
});
})