address greptile review feedback (greploop iteration 4)

- Add guard assertion before non-null click on custom code switch
- Use await act(async ...) for timer advancement to avoid act warnings
- Pin locale in date range assertion for CI determinism

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuneng-jiang
2026-03-18 13:09:17 -07:00
co-authored by Claude Opus 4.6
parent b75266d254
commit 51f78b7d72
2 changed files with 9 additions and 4 deletions
@@ -14,8 +14,10 @@ describe("ExportSummary", () => {
it("should display formatted date range", () => {
render(<ExportSummary dateRange={dateRange} selectedFilters={[]} />);
const text = screen.getByText(/\d+.*-.*\d+/);
expect(text).toBeInTheDocument();
// Pin locale to en-US so test is deterministic regardless of CI runner locale
const expectedFrom = dateRange.from!.toLocaleDateString("en-US");
const expectedTo = dateRange.to!.toLocaleDateString("en-US");
expect(screen.getByText(`${expectedFrom} - ${expectedTo}`)).toBeInTheDocument();
});
it("should show singular 'filter' for one filter", () => {
@@ -54,7 +54,10 @@ describe("GuardrailConfig", () => {
customCodeSwitch = container.querySelector('[role="switch"]');
container = container.parentElement;
}
await user.click(customCodeSwitch!);
if (!customCodeSwitch) {
throw new Error("Could not find the Custom Code Override switch via DOM traversal");
}
await user.click(customCodeSwitch);
expect(screen.getByPlaceholderText(/async def evaluate/)).toBeInTheDocument();
});
@@ -82,7 +85,7 @@ describe("GuardrailConfig", () => {
const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
render(<GuardrailConfig {...defaultProps} />);
await user.click(screen.getByRole("button", { name: /re-run on failing logs/i }));
act(() => { vi.advanceTimersByTime(2500); });
await act(async () => { vi.advanceTimersByTime(2500); });
expect(screen.getByText(/7\/10 would now pass/)).toBeInTheDocument();
});