diff --git a/src/tests/App.spec.tsx b/src/tests/App.spec.tsx index a3495692..a65e2120 100644 --- a/src/tests/App.spec.tsx +++ b/src/tests/App.spec.tsx @@ -12,3 +12,32 @@ test("✅ renderiza o componente App sem erros", () => { ); }); */ + + +// copiando o teste de csvTable que da certo + +import { render } from "@testing-library/react"; +import CsvTable from "../components/csvTable/csvTable"; +import '@testing-library/jest-dom/extend-expect'; + +describe("CsvTable", () => { + it("✅ should render the table headers and data correctly", () => { + + const head = ["Header 1", "Header 2", "Header 3"]; + const data = [ + ["Row 1, Cell 1", "Row 1, Cell 2", "Row 1, Cell 3"], + ["Row 2, Cell 1", "Row 2, Cell 2", "Row 2, Cell 3"], + ["Row 3, Cell 1", "Row 3, Cell 2", "Row 3, Cell 3"], + ]; + + const { getByText } = render(); + + head.forEach((headerText) => { + expect(getByText(headerText)).toBeInTheDocument(); + }); + + data.flat().forEach((cellText) => { + expect(getByText(cellText)).toBeInTheDocument(); + }); + }); +});