address greptile review feedback (greploop iteration 3)

- Remove Ant Design CSS class selector coupling in ExportFormatSelector test
- Lift mock fns out of TestTable component body to enable callback assertions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuneng-jiang
2026-03-18 12:48:01 -07:00
parent 56ed8379e2
commit bbc120095e
2 changed files with 12 additions and 6 deletions
@@ -22,9 +22,17 @@ const mockAgent: AgentHubData = {
is_public: true,
};
function TestTable({ data, publicPage = false }: { data: AgentHubData[]; publicPage?: boolean }) {
const showModal = vi.fn();
const copyToClipboard = vi.fn();
function TestTable({
data,
publicPage = false,
showModal = vi.fn(),
copyToClipboard = vi.fn(),
}: {
data: AgentHubData[];
publicPage?: boolean;
showModal?: ReturnType<typeof vi.fn>;
copyToClipboard?: ReturnType<typeof vi.fn>;
}) {
const columns = getAgentHubTableColumns(showModal, copyToClipboard, publicPage);
const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
@@ -27,9 +27,7 @@ describe("ExportFormatSelector", () => {
// Open the Ant Design Select dropdown
await user.click(screen.getByText("CSV (Excel, Google Sheets)"));
// Select JSON option from the dropdown
const jsonOption = await screen.findByText("JSON (includes metadata)", {
selector: ".ant-select-item-option-content",
});
const jsonOption = await screen.findByText("JSON (includes metadata)");
await user.click(jsonOption);
expect(onChange).toHaveBeenCalledWith("json", expect.anything());
});