From 4c3de2320fe4186482cc6b760be4cb5b045058f9 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Tue, 18 Aug 2026 18:03:02 -0700 Subject: [PATCH] test(ui): pin the cache control injection point in the add-model payload The cache control switch and its injection point list moved into advanced_settings when the model info view came off tremor, so the add-model payload gained two bindings that no case covered. Dropping the name from either one left the suite green. The injection point list seeds itself with initialValue, so asserting the key is present passes with the child unplugged. This case picks a role inside the child instead, which initialValue does not supply. --- .../panels/AddModelPanel.integration.test.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/panels/AddModelPanel.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/panels/AddModelPanel.integration.test.tsx index 32db6210e70..37d4d4fd31b 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/panels/AddModelPanel.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/panels/AddModelPanel.integration.test.tsx @@ -171,6 +171,12 @@ const PER_SECOND_PRICING_PAYLOAD = { input_cost_per_second: undefined, }; +const CACHE_CONTROL_PAYLOAD = { + ...EXPANDED_PAYLOAD, + cache_control: true, + cache_control_injection_points: [{ location: "message", role: "system" }], +}; + describe("AddModelPanel submit payload", () => { beforeEach(() => { vi.clearAllMocks(); @@ -248,4 +254,19 @@ describe("AddModelPanel submit payload", () => { expect(await submitAndCapturePayload(user)).toStrictEqual(PER_SECOND_PRICING_PAYLOAD); }); + + it("carries a cache control injection point chosen in the child through to the payload", async () => { + const user = setup(); + renderWithProviders(); + await fillRequiredFields(user); + await user.click(screen.getByText("Advanced Settings")); + await screen.findByText("LiteLLM Params"); + + await user.click(screen.getByLabelText(/Cache Control Injection Points/i)); + const roleCombos = await screen.findAllByRole("combobox"); + await user.click(roleCombos[roleCombos.length - 1]); + await user.click(await screen.findByRole("option", { name: "System" })); + + expect(await submitAndCapturePayload(user)).toStrictEqual(CACHE_CONTROL_PAYLOAD); + }); });