Basic testing setup

This commit is contained in:
David
2021-03-11 16:46:55 +01:00
parent a19e85df61
commit 6ca471af5f
6 changed files with 6272 additions and 2 deletions

13
__tests__/Error.test.tsx Normal file
View File

@@ -0,0 +1,13 @@
import { render, screen } from "@testing-library/react";
import Error from "next/error";
it("renders a not found message on 404 code", () => {
render(<Error statusCode={404} />);
expect(screen.getByText(/this page could not be found/i)).toBeVisible();
});
it("renders the correct status code", () => {
const code = Math.floor(Math.random() * 500) + 100;
render(<Error statusCode={code} />);
expect(screen.getByText(code)).toBeVisible();
});