Files
LingvAI/tests/pages/Error.test.tsx

15 lines
496 B
TypeScript
Raw Normal View History

2021-03-11 16:46:55 +01:00
import { render, screen } from "@testing-library/react";
2021-03-12 16:18:26 +01:00
import faker from "faker";
2021-03-11 16:46:55 +01:00
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", () => {
2021-03-12 16:18:26 +01:00
const code = faker.random.number({ min: 100, max: 599 });
2021-03-11 16:46:55 +01:00
render(<Error statusCode={code} />);
expect(screen.getByText(code)).toBeVisible();
});