mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
test(ui): share one chart bar lookup across Top Virtual Keys tests
The key_exists chart test added a second direct DOM lookup for the Recharts bars, which exposes no role or label, and pushed testing-library/no-node-access over its budget (709 > 707). Both chart tests now go through one helper
This commit is contained in:
parent
89bf870225
commit
82fd632153
1 changed files with 4 additions and 2 deletions
|
|
@ -29,6 +29,8 @@ vi.mock("../../../templates/key_info_view", () => ({
|
|||
),
|
||||
}));
|
||||
|
||||
const chartBars = (container: HTMLElement) => Array.from(container.querySelectorAll("path.recharts-rectangle"));
|
||||
|
||||
describe("TopKeyView", () => {
|
||||
const mockUseAuthorized = vi.mocked(useAuthorized);
|
||||
const mockKeyInfoV1Call = vi.mocked(networking.keyInfoV1Call);
|
||||
|
|
@ -206,7 +208,7 @@ describe("TopKeyView", () => {
|
|||
|
||||
await user.click(screen.getByRole("button", { name: "Chart View" }));
|
||||
|
||||
const bars = container.querySelectorAll("path.recharts-rectangle");
|
||||
const bars = chartBars(container);
|
||||
expect(bars).toHaveLength(1);
|
||||
expect(bars[0]).toHaveAttribute("fill", "var(--color-cyan-500, #06b6d4)");
|
||||
expect(screen.getAllByText("A Very Lon...").length).toBeGreaterThan(0);
|
||||
|
|
@ -511,7 +513,7 @@ describe("TopKeyView", () => {
|
|||
await user.click(screen.getByText("session-key"));
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "Chart View" }));
|
||||
const bars = container.querySelectorAll("path.recharts-rectangle");
|
||||
const bars = chartBars(container);
|
||||
expect(bars).toHaveLength(2);
|
||||
bars.forEach((bar) => fireEvent.click(bar));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue