From adea6c7c17229f2b6c795699c3d7833d21601ea7 Mon Sep 17 00:00:00 2001 From: Cameron Maloney Date: Thu, 21 Mar 2024 17:06:13 -0700 Subject: [PATCH] Atualizar App.spec.tsx pros testes darem certo --- src/tests/App.spec.tsx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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(); + }); + }); +});