diff --git a/src/Components/Checkfield/index.test.jsx b/src/Components/Checkfield/index.test.jsx
new file mode 100644
index 00000000..7144cc5e
--- /dev/null
+++ b/src/Components/Checkfield/index.test.jsx
@@ -0,0 +1,69 @@
+import "@testing-library/jest-dom";
+import { render, screen, fireEvent } from "@testing-library/react";
+import { describe, it, expect, vi } from "vitest";
+import CheckField from "./index";
+
+describe("CheckField Component", () => {
+ it("should render the component with the correct label", () => {
+ render();
+
+ const labelElement = screen.getByText("Test Label");
+ expect(labelElement).toBeInTheDocument();
+ });
+
+ it("should render as checked when 'checked' prop is true", () => {
+ render();
+
+ const checkbox = screen.getByRole("checkbox");
+ expect(checkbox).toBeChecked();
+ });
+
+ it("should render as unchecked when 'checked' prop is false", () => {
+ render();
+
+ const checkbox = screen.getByRole("checkbox");
+ expect(checkbox).not.toBeChecked();
+ });
+
+ it("should toggle the checkbox when clicked", () => {
+ render();
+
+ const checkbox = screen.getByRole("checkbox");
+ expect(checkbox).not.toBeChecked();
+
+ fireEvent.click(checkbox);
+
+ expect(checkbox).toBeChecked();
+
+ fireEvent.click(checkbox);
+
+ expect(checkbox).not.toBeChecked();
+ });
+
+ it("should call the 'onChange' function when clicked", () => {
+ const onChangeMock = vi.fn();
+ render();
+
+ const checkboxContainer = screen.getByText("Test Label");
+
+ fireEvent.click(checkboxContainer);
+
+ expect(onChangeMock).toHaveBeenCalledWith(true);
+
+ fireEvent.click(checkboxContainer);
+
+ expect(onChangeMock).toHaveBeenCalledWith(false);
+ });
+
+ it("should update the state when 'checked' prop changes", () => {
+ const { rerender } = render(
+
+ );
+
+ const checkbox = screen.getByRole("checkbox");
+ expect(checkbox).not.toBeChecked();
+
+ rerender();
+ expect(checkbox).toBeChecked();
+ });
+});
diff --git a/src/Components/Checklist/index.test.jsx b/src/Components/Checklist/index.test.jsx
new file mode 100644
index 00000000..05ed0051
--- /dev/null
+++ b/src/Components/Checklist/index.test.jsx
@@ -0,0 +1,135 @@
+import "@testing-library/jest-dom";
+import {
+ render,
+ screen,
+ fireEvent,
+ waitFor,
+ within,
+} from "@testing-library/react";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import CheckList from "./index";
+
+vi.mock("../BigModal", () => ({
+ __esModule: true,
+ default: ({ show, handleClose, children }) => (
+
+
+ {children}
+
+ ),
+}));
+
+describe("CheckList Component", () => {
+ const mockOnChange = vi.fn();
+ const items = [
+ {
+ _id: "1",
+ name: "John Doe",
+ email: "john@example.com",
+ religion: "Christian",
+ phone: "123456789",
+ cpf: "123.456.789-00",
+ birthDate: "1990-01-01",
+ sex: "Male",
+ address: "123 Main St",
+ naturalness: "City A",
+ uf_naturalidade: "SP",
+ marialStatus: "Single",
+ education: "Bachelor",
+ lotacao: "Office",
+ position: "Manager",
+ shipperOrganization: "Org A",
+ hiringDate: "2022-01-01",
+ dependents: [1, 2],
+ },
+ {
+ _id: "2",
+ name: "Jane Doe",
+ email: "jane@example.com",
+ religion: "Catholic",
+ phone: "987654321",
+ cpf: "987.654.321-00",
+ birthDate: "1995-05-15",
+ sex: "Female",
+ address: "456 Elm St",
+ naturalness: "City B",
+ uf_naturalidade: "RJ",
+ marialStatus: "Married",
+ education: "Master",
+ lotacao: "HQ",
+ position: "Director",
+ shipperOrganization: "Org B",
+ hiringDate: "2023-06-01",
+ dependents: [],
+ },
+ ];
+
+ const selectedValues = ["1"];
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("should render the list of items correctly", () => {
+ render(
+
+ );
+
+ expect(screen.getByText("John Doe")).toBeInTheDocument();
+ expect(screen.getByText("Jane Doe")).toBeInTheDocument();
+
+ const checkboxes = screen.getAllByRole("checkbox");
+ expect(checkboxes).toHaveLength(2);
+ expect(checkboxes[0]).toBeChecked();
+ expect(checkboxes[1]).not.toBeChecked();
+ });
+
+ it("should call onChange with updated values when a checkbox is clicked", () => {
+ render(
+
+ );
+
+ const secondCheckbox = screen.getAllByRole("checkbox")[1];
+ fireEvent.click(secondCheckbox);
+
+ expect(mockOnChange).toHaveBeenCalledWith(["1", "2"]);
+ });
+
+ it("should open the modal and display user details when an item is clicked", async () => {
+ 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();
+ expect(modalContent.getByText("john@example.com")).toBeInTheDocument();
+ expect(modalContent.getByText("Religião:")).toBeInTheDocument();
+ 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(
+
+ );
+
+ fireEvent.click(screen.getByText("John Doe"));
+ const modal = screen.getByTestId("big-modal");
+ expect(modal).toBeVisible();
+
+ fireEvent.click(screen.getByText("Close"));
+
+ await waitFor(() => {
+ expect(modal).not.toBeVisible();
+ });
+ });
+});
diff --git a/src/Components/Footer/index.test.jsx b/src/Components/Footer/index.test.jsx
new file mode 100644
index 00000000..8c153316
--- /dev/null
+++ b/src/Components/Footer/index.test.jsx
@@ -0,0 +1,55 @@
+import "@testing-library/jest-dom";
+import { render, screen } from "@testing-library/react";
+import Footer from "./index";
+import { describe, it, expect } from "vitest";
+
+describe("Footer Component", () => {
+ it("should render the Sindpol logo", () => {
+ render();
+
+ const logo = screen.getByAltText("Sindpol Logo");
+ expect(logo).toBeInTheDocument();
+ expect(logo).toHaveAttribute("src", "/src/assets/sindpol-logo.png");
+ });
+
+ it("should render the copyright text", () => {
+ render();
+
+ expect(
+ 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"
+ )
+ ).toBeInTheDocument();
+
+ expect(screen.getByText("Brasília/DF • CEP 70392-900")).toBeInTheDocument();
+ });
+
+ it("should render all social media links with correct URLs", () => {
+ render();
+
+ const expectedLinks = [
+ "https://www.facebook.com/sindpoldf",
+ "https://x.com/sindpoldf",
+ "https://www.youtube.com/@sindpoldf/videos",
+ "https://api.whatsapp.com/send/?phone=556133211949",
+ "https://www.instagram.com/sindpoldf/",
+ ];
+
+ const links = screen.getAllByRole("link");
+
+ expectedLinks.forEach((expectedHref) => {
+ const link = links.find(
+ (link) => link.getAttribute("href") === expectedHref
+ );
+ expect(link).toBeInTheDocument();
+ });
+
+ expect(links).toHaveLength(5);
+ });
+});
diff --git a/src/Components/SideBar/index.test.jsx b/src/Components/SideBar/index.test.jsx
new file mode 100644
index 00000000..97a1e6fe
--- /dev/null
+++ b/src/Components/SideBar/index.test.jsx
@@ -0,0 +1,115 @@
+import "@testing-library/jest-dom";
+import { render, screen, fireEvent } from "@testing-library/react";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { MemoryRouter, useNavigate } from "react-router-dom";
+import SideBar from "./index";
+import AuthContext from "../../Context/auth";
+import { usePermissions } from "../../Utils/permission";
+
+vi.mock("react-router-dom", async () => {
+ const actual = await vi.importActual("react-router-dom");
+ return {
+ ...actual,
+ useNavigate: vi.fn(),
+ };
+});
+
+vi.mock("../../Utils/permission", () => ({
+ usePermissions: vi.fn(),
+ checkModule: vi.fn(() => true),
+}));
+
+describe("SideBar Component", () => {
+ const mockNavigate = vi.fn();
+ const mockLogout = vi.fn();
+
+ const renderSideBar = (user = null) => {
+ useNavigate.mockReturnValue(mockNavigate);
+ usePermissions.mockReturnValue([]);
+
+ render(
+
+
+
+
+
+ );
+ };
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("should open sidebar when clicking the first button (menu icon)", () => {
+ renderSideBar();
+
+ const menuIcon = screen.getAllByRole("button")[0];
+ fireEvent.click(menuIcon);
+
+ expect(screen.getByText("PÁGINA INICIAL")).toBeInTheDocument();
+ });
+
+ it("should navigate to 'PÁGINA INICIAL' when button is clicked", () => {
+ renderSideBar();
+
+ const menuIcon = screen.getAllByRole("button")[0];
+ fireEvent.click(menuIcon);
+
+ const homeButton = screen.getByText("PÁGINA INICIAL");
+ fireEvent.click(homeButton);
+
+ expect(mockNavigate).toHaveBeenCalledWith("/home");
+ });
+
+ it("should display user information when user is logged in", () => {
+ const mockUser = { name: "John Doe", role: "admin" };
+ renderSideBar(mockUser);
+
+ expect(
+ screen.getByText("Você está logado como John Doe")
+ ).toBeInTheDocument();
+ });
+
+ it("should call Logout and navigate to '/' on logout", () => {
+ const mockUser = { name: "John Doe" };
+ renderSideBar(mockUser);
+
+ const logoutButton = screen.getByText("LOGOUT");
+ fireEvent.click(logoutButton);
+
+ expect(mockLogout).toHaveBeenCalled();
+ expect(mockNavigate).toHaveBeenCalledWith("/");
+ });
+
+ it("should navigate to 'FILIAÇÃO' when button is clicked", () => {
+ renderSideBar();
+
+ const menuIcon = screen.getAllByRole("button")[0];
+ fireEvent.click(menuIcon);
+
+ const filiationButton = screen.getByText("FILIAÇÃO");
+ fireEvent.click(filiationButton);
+
+ expect(mockNavigate).toHaveBeenCalledWith("/filiacao");
+ });
+
+ 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
new file mode 100644
index 00000000..25280a8e
--- /dev/null
+++ b/src/Components/SideButton/index.test.jsx
@@ -0,0 +1,41 @@
+import "@testing-library/jest-dom";
+import { render, screen, fireEvent } from "@testing-library/react";
+import { describe, it, expect, vi } from "vitest";
+import SideButton from "./index";
+
+describe("SideButton Component", () => {
+ it("should render the button with the correct text", () => {
+ render( {}} />);
+
+ const button = screen.getByRole("button", { name: "Test Button" });
+ expect(button).toBeInTheDocument();
+ });
+
+ it("should call the 'onClick' function when the button is clicked", () => {
+ const onClickMock = vi.fn();
+ render();
+
+ const button = screen.getByRole("button", { name: "Click Me" });
+ fireEvent.click(button);
+
+ expect(onClickMock).toHaveBeenCalledTimes(1);
+ });
+
+ it("should hide the button when 'hidden' prop is set to 'none'", () => {
+ 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(
+ {}} />
+ );
+
+ 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
new file mode 100644
index 00000000..effff6c7
--- /dev/null
+++ b/src/Pages/Protected/Carteirinha/index.test.jsx
@@ -0,0 +1,103 @@
+/* eslint-disable no-undef */
+import "@testing-library/jest-dom";
+import { render, screen, waitFor, fireEvent } from "@testing-library/react";
+import { describe, it, expect, vi } from "vitest";
+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",
+ height: 600,
+ width: 800,
+ }),
+}));
+
+vi.mock("jspdf", () => ({
+ jsPDF: vi.fn().mockImplementation(() => ({
+ addImage: vi.fn(),
+ save: vi.fn(),
+ })),
+}));
+
+describe("Carteirinha Component", () => {
+ const mockMembershipData = [
+ {
+ name: "John Doe",
+ birthDate: "1990-01-01",
+ cpf: "123.456.789-00",
+ expeditionDate: "2023-08-01",
+ hiringDate: "2022-06-15",
+ },
+ ];
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ global.fetch = vi.fn(() =>
+ Promise.resolve({
+ json: () => Promise.resolve(mockMembershipData),
+ })
+ );
+ });
+
+ afterEach(() => {
+ delete global.fetch;
+ });
+
+ it("should display 'Carregando dados...' while fetching data", () => {
+ render();
+ expect(screen.getByText("Carregando dados...")).toBeInTheDocument();
+ });
+
+ it("should render membership data correctly", async () => {
+ render();
+
+ await waitFor(() => {
+ expect(screen.getByText("John Doe")).toBeInTheDocument();
+ expect(screen.getByText("123.456.789-00")).toBeInTheDocument();
+ });
+ });
+
+ it("should call downloadPDF when clicking on 'BAIXAR CARTEIRINHA' button", async () => {
+ const mockSave = vi.fn();
+ jsPDF.mockImplementation(() => ({
+ addImage: vi.fn(),
+ save: mockSave,
+ }));
+
+ render();
+
+ await waitFor(() => {
+ expect(screen.getByText("BAIXAR CARTEIRINHA")).toBeInTheDocument();
+ });
+
+ const button = screen.getByText("BAIXAR CARTEIRINHA");
+ fireEvent.click(button);
+
+ await waitFor(() => {
+ expect(html2canvas).toHaveBeenCalled();
+ expect(mockSave).toHaveBeenCalledWith("carteirinha.pdf");
+ });
+ });
+
+ it("should log an error if fetch fails", async () => {
+ vi.spyOn(console, "error").mockImplementation(() => {});
+ global.fetch = vi.fn(() => Promise.reject(new Error("Fetch error")));
+
+ render();
+
+ await waitFor(() => {
+ expect(screen.getByText("Carregando dados...")).toBeInTheDocument();
+ });
+
+ await waitFor(() => {
+ expect(console.error).toHaveBeenCalledWith(
+ "Erro ao buscar os dados do membership:",
+ expect.any(Error)
+ );
+ });
+
+ console.error.mockRestore();
+ });
+});
diff --git a/src/Pages/Protected/Carteirinha/index.teste.jsx b/src/Pages/Protected/Carteirinha/index.teste.jsx
deleted file mode 100644
index e69de29b..00000000