address greptile review feedback (greploop iteration 1)

- Move vi.useRealTimers() to afterEach for proper cleanup
- Use label-based DOM queries instead of fragile positional indexes
- Remove leftover debug console.log from AgentHubTableColumns.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuneng-jiang
2026-03-18 12:31:25 -07:00
co-authored by Claude Opus 4.6
parent 20c1d984a6
commit 40721ab18f
3 changed files with 16 additions and 9 deletions
@@ -194,7 +194,6 @@ export const getAgentHubTableColumns = (
return publicA - publicB;
},
cell: ({ row }) => {
console.log(`CHECKPOINT 1: ${JSON.stringify(row.original)}`);
const agent = row.original;
return agent.is_public === true ? (
@@ -31,7 +31,7 @@ describe("ExportTypeSelector", () => {
it("should have the correct radio checked based on value prop", () => {
render(<ExportTypeSelector value="daily_with_models" onChange={vi.fn()} entityType="team" />);
const radios = screen.getAllByRole("radio");
expect(radios[2]).toBeChecked();
const modelRadio = screen.getByRole("radio", { name: /by team and model/i });
expect(modelRadio).toBeChecked();
});
});
@@ -10,6 +10,10 @@ describe("GuardrailConfig", () => {
provider: "bedrock",
};
afterEach(() => {
vi.useRealTimers();
});
it("should render", () => {
render(<GuardrailConfig {...defaultProps} />);
expect(screen.getByText("Parameters")).toBeInTheDocument();
@@ -39,10 +43,16 @@ describe("GuardrailConfig", () => {
it("should show custom code textarea when custom code override is toggled on", async () => {
const user = userEvent.setup();
render(<GuardrailConfig {...defaultProps} />);
const switches = screen.getAllByRole("switch");
// The second switch is the custom code override toggle
const customCodeSwitch = switches[1];
await user.click(customCodeSwitch);
// Walk up from "Custom Code Override" heading to find the enclosing section,
// then locate the switch within it
const heading = screen.getByText("Custom Code Override");
let container = heading.parentElement;
let customCodeSwitch: Element | null = null;
while (container && !customCodeSwitch) {
customCodeSwitch = container.querySelector('[role="switch"]');
container = container.parentElement;
}
await user.click(customCodeSwitch!);
expect(screen.getByPlaceholderText(/async def evaluate/)).toBeInTheDocument();
});
@@ -63,7 +73,6 @@ describe("GuardrailConfig", () => {
render(<GuardrailConfig {...defaultProps} />);
await user.click(screen.getByRole("button", { name: /re-run on failing logs/i }));
expect(screen.getByText(/Running on 10 samples/)).toBeInTheDocument();
vi.useRealTimers();
});
it("should show success message after re-run completes", async () => {
@@ -73,7 +82,6 @@ describe("GuardrailConfig", () => {
await user.click(screen.getByRole("button", { name: /re-run on failing logs/i }));
act(() => { vi.advanceTimersByTime(2500); });
expect(screen.getByText(/7\/10 would now pass/)).toBeInTheDocument();
vi.useRealTimers();
});
it("should display the Revert and Save buttons", () => {