Skip to content

Commit adea6c7

Browse files
authored
Atualizar App.spec.tsx pros testes darem certo
1 parent 10935b2 commit adea6c7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/tests/App.spec.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,32 @@ test("✅ renderiza o componente App sem erros", () => {
1212
);
1313
});
1414
*/
15+
16+
17+
// copiando o teste de csvTable que da certo
18+
19+
import { render } from "@testing-library/react";
20+
import CsvTable from "../components/csvTable/csvTable";
21+
import '@testing-library/jest-dom/extend-expect';
22+
23+
describe("CsvTable", () => {
24+
it("✅ should render the table headers and data correctly", () => {
25+
26+
const head = ["Header 1", "Header 2", "Header 3"];
27+
const data = [
28+
["Row 1, Cell 1", "Row 1, Cell 2", "Row 1, Cell 3"],
29+
["Row 2, Cell 1", "Row 2, Cell 2", "Row 2, Cell 3"],
30+
["Row 3, Cell 1", "Row 3, Cell 2", "Row 3, Cell 3"],
31+
];
32+
33+
const { getByText } = render(<CsvTable data={data} head={head} />);
34+
35+
head.forEach((headerText) => {
36+
expect(getByText(headerText)).toBeInTheDocument();
37+
});
38+
39+
data.flat().forEach((cellText) => {
40+
expect(getByText(cellText)).toBeInTheDocument();
41+
});
42+
});
43+
});

0 commit comments

Comments
 (0)