Fix tests
This commit is contained in:
parent
c76c40af05
commit
f5d7fc2050
3 changed files with 9 additions and 11 deletions
|
@ -7,7 +7,8 @@ export function ErrorRenderer({ error }: { error: Error }) {
|
||||||
<div data-testid="error" className="w-full h-48">
|
<div data-testid="error" className="w-full h-48">
|
||||||
<div className="flex flex-col h-5/6 justify-center w-3/4 m-auto"></div>
|
<div className="flex flex-col h-5/6 justify-center w-3/4 m-auto"></div>
|
||||||
<Footer>
|
<Footer>
|
||||||
<span className="font-bold">{t("error")}</span>: {error.message}
|
<span className="font-bold">{t("error")}</span>:
|
||||||
|
<span data-testid="error-message">{error.message}</span>
|
||||||
</Footer>
|
</Footer>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,9 @@ describe("ErrorRenderer.tsx", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("an error is rendered", () => {
|
test("an error is rendered", () => {
|
||||||
expect(screen.getByText("Error")).toBeInTheDocument();
|
const { getByTestId, getByText } = screen;
|
||||||
expect(screen.getByText(error.message)).toBeInTheDocument();
|
const span = getByTestId("error-message");
|
||||||
|
expect(getByText("Error")).toBeInTheDocument();
|
||||||
|
expect(span.textContent).toEqual(error.message);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,14 +39,9 @@ describe("ResponseRenderer.tsx", () => {
|
||||||
expect(screen.getByText(response.ISP)).toBeInTheDocument();
|
expect(screen.getByText(response.ISP)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("a city is rendered", () => {
|
test("a location is rendered", () => {
|
||||||
expect(screen.getByText("City")).toBeInTheDocument();
|
expect(screen.getByText("Location")).toBeInTheDocument();
|
||||||
expect(screen.getByText(response.City)).toBeInTheDocument();
|
expect(screen.getByText(`${response.City}, ${response.Country}`)).toBeInTheDocument();
|
||||||
});
|
|
||||||
|
|
||||||
test("a country is rendered", () => {
|
|
||||||
expect(screen.getByText("Country")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText(response.Country)).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("isTorExitNode is rendered as No", () => {
|
test("isTorExitNode is rendered as No", () => {
|
||||||
|
|
Loading…
Reference in a new issue