From 3694212c2923d0fd497eadc992c6469983e55c66 Mon Sep 17 00:00:00 2001 From: arsam Date: Fri, 18 Sep 2026 23:11:20 +0330 Subject: [PATCH] Import tests: tests/unit/data-table Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality. --- tests/unit/data-table.test.tsx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/unit/data-table.test.tsx diff --git a/tests/unit/data-table.test.tsx b/tests/unit/data-table.test.tsx new file mode 100644 index 0000000..b2e190e --- /dev/null +++ b/tests/unit/data-table.test.tsx @@ -0,0 +1,32 @@ +"use client"; + +import { render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { describe, expect, it } from "vitest"; +import type { ColumnDef } from "@tanstack/react-table"; +import { DataTable } from "@/components/common/data-table"; + +type Row = { name: string; status: string }; + +const columns: ColumnDef[] = [ + { accessorKey: "name", header: "Name" }, + { accessorKey: "status", header: "Status" }, +]; + +describe("DataTable", () => { + it("filters rows by search input", async () => { + render( + , + ); + + await userEvent.type(screen.getByPlaceholderText("Search"), "Beta"); + expect(screen.getByText("Beta")).toBeInTheDocument(); + expect(screen.queryByText("Alpha")).not.toBeInTheDocument(); + }); +});