import { describe, expect, it } from "bun:test"; import { renderToString } from "react-dom/server"; import { DataTable } from "."; import { StoreProvider, createStore } from "../../hooks/useStore"; import { FancyValueColumn, data, type Payment } from "./DataTable.stories"; describe("datatable", () => { it("should pass tests", () => { expect(true).toBe(true); }); it("should work when server rendered", () => { const markup = renderToString(); expect(markup).toMatchInlineSnapshot( `"
Actions
success
316
success
242
processing
837
success
874
failed
721
success
316
success
242
processing
837
success
874
failed
721
0 of 14 row(s) selected.

Rows per page

Page 1 of 2
"`, ); }); }); const TestTable = () => { const useStore = createStore({}); return ( header="Status" accessorFn={(row) => row.status} > {(original) =>
{original.status}
} header="Amount" accessorFn={(row) => row.amount} > {(original) => (
{original.amount}
)} header="Actions"> {(original) => (
)}
); };