diff --git a/src/Components/Checkfield/index.test.jsx b/src/Components/Checkfield/index.test.jsx
index f3eb1ff..7144cc5 100644
--- a/src/Components/Checkfield/index.test.jsx
+++ b/src/Components/Checkfield/index.test.jsx
@@ -56,7 +56,9 @@ describe("CheckField Component", () => {
});
it("should update the state when 'checked' prop changes", () => {
- const { rerender } = render();
+ const { rerender } = render(
+
+ );
const checkbox = screen.getByRole("checkbox");
expect(checkbox).not.toBeChecked();
diff --git a/src/Components/Checklist/index.test.jsx b/src/Components/Checklist/index.test.jsx
index 014f1e9..05ed005 100644
--- a/src/Components/Checklist/index.test.jsx
+++ b/src/Components/Checklist/index.test.jsx
@@ -1,5 +1,11 @@
import "@testing-library/jest-dom";
-import { render, screen, fireEvent, waitFor, within } from "@testing-library/react";
+import {
+ render,
+ screen,
+ fireEvent,
+ waitFor,
+ within,
+} from "@testing-library/react";
import { describe, it, expect, vi, beforeEach } from "vitest";
import CheckList from "./index";
@@ -65,7 +71,9 @@ describe("CheckList Component", () => {
});
it("should render the list of items correctly", () => {
- render();
+ render(
+
+ );
expect(screen.getByText("John Doe")).toBeInTheDocument();
expect(screen.getByText("Jane Doe")).toBeInTheDocument();
@@ -77,7 +85,9 @@ describe("CheckList Component", () => {
});
it("should call onChange with updated values when a checkbox is clicked", () => {
- render();
+ render(
+
+ );
const secondCheckbox = screen.getAllByRole("checkbox")[1];
fireEvent.click(secondCheckbox);
@@ -86,15 +96,17 @@ describe("CheckList Component", () => {
});
it("should open the modal and display user details when an item is clicked", async () => {
- render();
-
+ render(
+
+ );
+
fireEvent.click(screen.getByText("John Doe"));
-
+
const modal = screen.getByTestId("big-modal");
expect(modal).toBeVisible();
-
+
const modalContent = within(modal);
-
+
expect(modalContent.getByText("Nome:")).toBeInTheDocument();
expect(modalContent.getByText("John Doe")).toBeInTheDocument();
expect(modalContent.getByText("Email:")).toBeInTheDocument();
@@ -103,10 +115,12 @@ describe("CheckList Component", () => {
expect(modalContent.getByText("Christian")).toBeInTheDocument();
expect(modalContent.getByText("Dependentes:")).toBeInTheDocument();
expect(modalContent.getByText("2")).toBeInTheDocument();
- });
+ });
it("should close the modal when the close button is clicked", async () => {
- render();
+ render(
+
+ );
fireEvent.click(screen.getByText("John Doe"));
const modal = screen.getByTestId("big-modal");
diff --git a/src/Components/Footer/index.test.jsx b/src/Components/Footer/index.test.jsx
index a4e8905..8c15331 100644
--- a/src/Components/Footer/index.test.jsx
+++ b/src/Components/Footer/index.test.jsx
@@ -16,11 +16,15 @@ describe("Footer Component", () => {
render();
expect(
- screen.getByText("Copyright © 2024 • Sindpol-DF • CNPJ 11.236.674/0001-06")
+ screen.getByText(
+ "Copyright © 2024 • Sindpol-DF • CNPJ 11.236.674/0001-06"
+ )
).toBeInTheDocument();
expect(
- screen.getByText("Setor de Diversões Sul (SDS), Conjunto Baracat Bloco F 27, Salas 313/315 • Asa Sul")
+ screen.getByText(
+ "Setor de Diversões Sul (SDS), Conjunto Baracat Bloco F 27, Salas 313/315 • Asa Sul"
+ )
).toBeInTheDocument();
expect(screen.getByText("Brasília/DF • CEP 70392-900")).toBeInTheDocument();
@@ -40,7 +44,9 @@ describe("Footer Component", () => {
const links = screen.getAllByRole("link");
expectedLinks.forEach((expectedHref) => {
- const link = links.find((link) => link.getAttribute("href") === expectedHref);
+ const link = links.find(
+ (link) => link.getAttribute("href") === expectedHref
+ );
expect(link).toBeInTheDocument();
});
diff --git a/src/Components/SideBar/index.test.jsx b/src/Components/SideBar/index.test.jsx
index 7a5a718..97a1e6f 100644
--- a/src/Components/SideBar/index.test.jsx
+++ b/src/Components/SideBar/index.test.jsx
@@ -70,7 +70,9 @@ describe("SideBar Component", () => {
const mockUser = { name: "John Doe", role: "admin" };
renderSideBar(mockUser);
- expect(screen.getByText("Você está logado como John Doe")).toBeInTheDocument();
+ expect(
+ screen.getByText("Você está logado como John Doe")
+ ).toBeInTheDocument();
});
it("should call Logout and navigate to '/' on logout", () => {
@@ -98,16 +100,16 @@ describe("SideBar Component", () => {
it("should hide restricted buttons if user has no permissions", () => {
usePermissions.mockReturnValue([]);
-
+
renderSideBar();
-
+
const menuIcon = screen.getAllByRole("button")[0];
fireEvent.click(menuIcon);
-
+
const cadastrosButton = screen.getByText("CADASTROS");
expect(cadastrosButton).toBeInTheDocument();
-
+
const beneficiosButton = screen.getByText("BENEFÍCIOS");
expect(beneficiosButton).toBeInTheDocument();
- });
+ });
});
diff --git a/src/Components/SideButton/index.test.jsx b/src/Components/SideButton/index.test.jsx
index 0aefde9..25280a8 100644
--- a/src/Components/SideButton/index.test.jsx
+++ b/src/Components/SideButton/index.test.jsx
@@ -22,14 +22,18 @@ describe("SideButton Component", () => {
});
it("should hide the button when 'hidden' prop is set to 'none'", () => {
- render( {}} />);
+ render(
+ {}} />
+ );
const button = screen.queryByRole("button", { name: "Hidden Button" });
expect(button).not.toBeInTheDocument();
});
it("should show the button when 'hidden' prop is set to 'flex'", () => {
- render( {}} />);
+ render(
+ {}} />
+ );
const button = screen.getByRole("button", { name: "Visible Button" });
expect(button).toBeInTheDocument();
diff --git a/src/Pages/Protected/Carteirinha/index.test.jsx b/src/Pages/Protected/Carteirinha/index.test.jsx
index 01f0efa..d000698 100644
--- a/src/Pages/Protected/Carteirinha/index.test.jsx
+++ b/src/Pages/Protected/Carteirinha/index.test.jsx
@@ -6,7 +6,6 @@ import Carteirinha from "./index";
import html2canvas from "html2canvas";
import { jsPDF } from "jspdf";
-
vi.mock("html2canvas", () => ({
default: vi.fn().mockResolvedValue({
toDataURL: () => "data:image/png;base64,mockImage",
@@ -53,7 +52,7 @@ describe("Carteirinha Component", () => {
it("should render membership data correctly", async () => {
render();
-
+
await waitFor(() => {
expect(screen.getByText("John Doe")).toBeInTheDocument();
expect(screen.getByText("12/31/1989")).toBeInTheDocument(); // Data de nascimento
@@ -61,7 +60,7 @@ describe("Carteirinha Component", () => {
expect(screen.getByText("6/14/2022")).toBeInTheDocument(); // Data de contratação
expect(screen.getByText("123.456.789-00")).toBeInTheDocument(); // CPF
});
- });
+ });
it("should call downloadPDF when clicking on 'BAIXAR CARTEIRINHA' button", async () => {
const mockSave = vi.fn();