fixing test

This commit is contained in:
yuneng-jiang
2026-02-06 20:47:43 -08:00
parent e968e3798c
commit 8ae1fe32c4
2 changed files with 12 additions and 2 deletions
@@ -44,7 +44,10 @@ const renderWithForm = (props = {}) => {
it("should default allow_all_keys switch to unchecked for new servers", async () => {
renderWithForm();
await expandPanel();
const toggle = screen.getByRole("switch");
// Find the switch associated with "Allow All LiteLLM Keys" text
// The first switch in the component is for allow_all_keys
const switches = screen.getAllByRole("switch");
const toggle = switches[0];
expect(toggle).toHaveAttribute("aria-checked", "false");
});
@@ -62,7 +65,10 @@ const renderWithForm = (props = {}) => {
});
const user = await expandPanel();
const toggle = screen.getByRole("switch");
// Find the switch associated with "Allow All LiteLLM Keys" text
// The first switch in the component is for allow_all_keys
const switches = screen.getAllByRole("switch");
const toggle = switches[0];
expect(toggle).toHaveAttribute("aria-checked", "true");
await user.click(toggle);
@@ -11,6 +11,10 @@ vi.mock("../networking", () => ({
fetchMCPServerHealth: vi.fn(),
deleteMCPServer: vi.fn(),
getProxyBaseUrl: vi.fn().mockReturnValue("http://localhost:4000"),
fetchMCPClientIp: vi.fn().mockResolvedValue(null),
getGeneralSettingsCall: vi.fn().mockResolvedValue([]),
updateConfigFieldSetting: vi.fn().mockResolvedValue(undefined),
deleteConfigFieldSetting: vi.fn().mockResolvedValue(undefined),
}));
// Mock NotificationsManager