litellm/ui/litellm-dashboard/src/components/GuardrailsMonitor
Yuneng Jiang c82acbc0de
test(ui): preserve global Button/Tooltip mocks in per-file @tremor/react vi.mock
Per-file `vi.mock("@tremor/react", ...)` factories fully replace the
setup-level mock from `tests/setupTests.ts`, so the global Button/Tooltip
overrides are lost in any file that re-mocks `@tremor/react`. Without
them, the real Tremor `<Button>` leaks through and its internal
`useTooltip(300)` schedules a native 300ms `setTimeout` on pointer
events. When the test environment is torn down before the timer fires,
the trailing `setState` calls `getCurrentEventPriority`, which reads
`window.event` against a destroyed jsdom -> "window is not defined"
flake observed on CI.

Patches the 7 leaky test files to re-supply `Button` (bare `<button>`)
and `Tooltip` (Fragment) overrides matching `setupTests.ts`. Also drops
a dead `afterEach` workaround in `user_edit_view.test.tsx` (the
fake-timer dance it ran could not drain a real timer scheduled before
the swap) and corrects a misleading comment in `MakeMCPPublicForm.test.tsx`.
2026-05-14 14:01:02 -07:00
..
EvaluationSettingsModal.tsx
GuardrailConfig.test.tsx address greptile review feedback (greploop iteration 4) 2026-03-18 13:09:17 -07:00
GuardrailConfig.tsx
GuardrailDetail.tsx refactor(ui): use antd grid for guardrails monitor metrics 2026-04-15 11:34:44 -07:00
GuardrailsMonitorView.test.tsx
GuardrailsMonitorView.tsx
GuardrailsOverview.tsx refactor(ui): use antd grid for guardrails monitor metrics 2026-04-15 11:34:44 -07:00
LogViewer.tsx Guardrail Monitor - measure guardrail reliability in prod (#21944) 2026-02-23 10:23:14 -08:00
MetricCard.test.tsx [Test] UI: Add unit tests for 10 previously untested components 2026-03-18 12:18:42 -07:00
MetricCard.tsx
mockData.ts
ScoreChart.test.tsx test(ui): preserve global Button/Tooltip mocks in per-file @tremor/react vi.mock 2026-05-14 14:01:02 -07:00
ScoreChart.tsx refactor(ui): reduce Tremor usage in Guardrails Monitor layout 2026-04-15 10:39:25 -07:00