-
Notifications
You must be signed in to change notification settings - Fork 2
/
ExportedEntityDetailsTable.test.tsx
46 lines (42 loc) · 1.52 KB
/
ExportedEntityDetailsTable.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { render } from "@testing-library/react";
import { ReportContext } from "components/reports/ReportProvider";
import { axe } from "jest-axe";
import {
mockMlrReportContext,
mockModalOverlayReportPageWithOverlayJson,
} from "utils/testing/setupJest";
import { ExportedEntityDetailsTable } from "./ExportedEntityDetailsTable";
const exportedEntityDetailsTableComponent = () => (
<ReportContext.Provider value={mockMlrReportContext}>
<ExportedEntityDetailsTable
fields={mockModalOverlayReportPageWithOverlayJson.overlayForm.fields}
entity={mockMlrReportContext.report.fieldData.program[0]}
data-testid="exportedEntityDetailsTable"
></ExportedEntityDetailsTable>
</ReportContext.Provider>
);
describe("ExportedEntityDetailsTable", () => {
it("renders successfully", async () => {
const { findAllByText, findByTestId } = render(
exportedEntityDetailsTableComponent()
);
expect(await findByTestId("exportedEntityDetailsTable"));
const expectedTextContent = [
"N/A",
"mock text field",
"mock number field",
"Not answered; required",
];
for (const content of expectedTextContent) {
for (const element of await findAllByText(content)) {
expect(element).toBeVisible();
}
}
});
});
describe("ExportedEntityDetailsTable has no accessibility issues", () => {
it("should have no violations", async () => {
const { container } = render(exportedEntityDetailsTableComponent());
expect(await axe(container)).toHaveNoViolations();
});
});