test(ui): keep agent identity form assertions type-safe

This commit is contained in:
Joshua Valluru 2026-09-26 13:39:25 -07:00
parent bec727d07f
commit 2b6bf317bf
2 changed files with 3 additions and 3 deletions

View file

@ -186,7 +186,7 @@ describe("AgentInfoView update payload", () => {
expect(screen.getByLabelText("Application (Client) ID")).toHaveValue(identity.client_id);
expect(screen.getByRole("combobox", { name: "Identity Provider" })).toHaveTextContent("Microsoft Entra ID");
expect(screen.getByRole("combobox", { name: "Execution Mode" })).toHaveTextContent("Autonomous");
expect(screen.getByRole("combobox", { name: "Execution", exact: true })).toHaveTextContent("Enabled");
expect(screen.getByRole("combobox", { name: /^Execution$/ })).toHaveTextContent("Enabled");
fireEvent.change(screen.getByLabelText("Agent Name"), { target: { value: "Renamed agent" } });
await save(user);
expect(patchedPayload().agent_name).toBe("Renamed agent");

View file

@ -115,7 +115,7 @@ describe("AgentInfoView settings", () => {
it("saves unrelated settings when the existing card has no description", async () => {
const actual = await vi.importActual<typeof import("./agent_form_fields")>("./agent_form_fields");
vi.mocked(AgentFormFields).mockImplementation(actual.default);
const { description: _description, ...card } = agent.agent_card_params;
const { description: _description, ...card } = agent.agent_card_params ?? {};
vi.mocked(networking.getAgentInfo).mockResolvedValue({ ...agent, agent_card_params: card });
render(<AgentInfoView agentId="agent-1" onClose={vi.fn()} accessToken="sk-test" isAdmin={true} />);
fireEvent.click(await screen.findByRole("tab", { name: "Settings" }));
@ -126,7 +126,7 @@ describe("AgentInfoView settings", () => {
await waitFor(() => expect(networking.patchAgentCall).toHaveBeenCalledOnce());
const [, , payload] = vi.mocked(networking.patchAgentCall).mock.calls[0];
expect(payload.tpm_limit).toBe(42);
expect(payload.agent_card_params.description).toBe("");
expect(payload.agent_card_params?.description).toBe("");
});
it("sends the newly attached access group in the update payload", async () => {