Skip to content

Commit

Permalink
Atualizar App.spec.tsx pros testes darem certo
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 authored Mar 22, 2024
1 parent 10935b2 commit adea6c7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/tests/App.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<CsvTable data={data} head={head} />);

head.forEach((headerText) => {
expect(getByText(headerText)).toBeInTheDocument();
});

data.flat().forEach((cellText) => {
expect(getByText(cellText)).toBeInTheDocument();
});
});
});

0 comments on commit adea6c7

Please sign in to comment.