-
Notifications
You must be signed in to change notification settings - Fork 3
/
SimpleTable.test.js
40 lines (39 loc) · 1.52 KB
/
SimpleTable.test.js
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
import React from "react";
import { render } from "./test-utils";
import { SimpleTable } from "./SimpleTable";
describe("SimpleTable", () => {
it("should have 8 rows", () => {
const { getAllRows } = render(<SimpleTable />);
expect(getAllRows()).toHaveLength(8);
});
it("should have a header row", () => {
const { getRowByRowgroupType } = render(<SimpleTable />);
expect(getRowByRowgroupType("thead")).toBeVisible();
});
it("should have 7 body rows", () => {
const { getAllRowsByRowgroupType } = render(<SimpleTable />);
expect(getAllRowsByRowgroupType("tbody")).toHaveLength(7);
});
it("should not have a footer row", () => {
const { queryRowByRowgroupType } = render(<SimpleTable />);
expect(queryRowByRowgroupType("tfoot")).toBeNull();
});
it("should have 48 cells", () => {
const { getAllCells } = render(<SimpleTable />);
expect(getAllCells()).toHaveLength(48);
});
it("should have a Status column", () => {
const { getAllColumnCellsByHeaderText } = render(<SimpleTable />);
expect(getAllColumnCellsByHeaderText("Status")).toHaveLength(8);
});
it('should have a row for "reason guest"', () => {
const { getRowByFirstCellText } = render(<SimpleTable />);
expect(getRowByFirstCellText("reason")).toBeVisible();
});
it('should have "trouble skirt"s status as relationship', () => {
const { getCellByRowAndColumnHeaders } = render(<SimpleTable />);
expect(getCellByRowAndColumnHeaders("trouble", "Status")).toHaveTextContent(
"relationship"
);
});
});