import React from "react"; import { render, screen } from "@testing-library/react"; import { expect, test, describe } from "vitest"; // Component import TableLayout from "./TableLayout"; const tableBody = [
Table Body Item
,
Table Body Item
, ]; describe("TableLayout Component", () => { test("should display the TableLayout with required props with table body", () => { render( ); expect(screen.getByLabelText("test-table")).toBeInTheDocument(); expect(screen.getAllByText("Table Body Item")).toHaveLength(2); }); test("should display the EmptyBodyTable when there is no table body", () => { render( ); expect(screen.getByLabelText("test-table2")).toBeInTheDocument(); expect(screen.getByText("No results found")).toBeInTheDocument(); expect( screen.getByText("Clear all filters and try again.") ).toBeInTheDocument(); }); });