Files
LingvAI/tests/components/CustomError.test.tsx
David ea8c1bad57 Blocking behaviour while typing fixed + added spinner (#6)
* Some README tweaks

* Next's staticProps blocking beheaviour while typing fixed + Added spinner

* Testing for previous fix

* Faker deprecational update
2021-04-01 15:40:25 +02:00

25 lines
1003 B
TypeScript

import { render, screen } from "../reactUtils";
import faker from "faker";
import CustomError from "../../components/CustomError";
const code = faker.datatype.number({ min: 400, max: 599 });
const text = faker.random.words();
it("loads the layout correctly", async () => {
render(<CustomError statusCode={code} statusText={text} />);
expect(screen.getByRole("link", { name: /skip to content/i })).toBeEnabled();
expect(await screen.findByRole("img", { name: /logo/i })).toBeVisible();
expect(screen.getByRole("button", { name: /toggle color mode/i })).toBeEnabled();
expect(screen.getByRole("link", { name: /github/i })).toBeEnabled();
expect(screen.getByText(/\xA9/)).toBeVisible();
});
it("renders the correct status code & text", () => {
const code = faker.datatype.number({ min: 400, max: 599 });
render(<CustomError statusCode={code} statusText={text} />);
expect(screen.getByText(code)).toBeVisible();
expect(screen.getByText(text)).toBeVisible();
});