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.
This commit is contained in:
Yuneng Jiang 2026-08-18 18:03:02 -07:00
parent d831f98326
commit 4c3de2320f
No known key found for this signature in database

View file

@ -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(<AddModelPanel />);
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);
});
});