fix(permissions): tools MCP inter-projets exposés (idea_project_*) + contactable agent/template persisté — update_agent_contactable (application/web-server/app-tauri), defaultContactable TemplateEditor save/reopen, groupes MCP 'IdeA inter-projets' avec fallback, permissions agent Contactable — #267 (QA verte)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
||||
|
||||
import {
|
||||
@ -103,7 +103,9 @@ describe("PermissionsPanel", () => {
|
||||
});
|
||||
|
||||
it("defaults cross-project contactability off and persists the agent checkbox", async () => {
|
||||
const { permission } = await renderPanel();
|
||||
const { agent, permission } = await renderPanel();
|
||||
const contactableSpy = vi.spyOn(agent, "updateAgentContactable");
|
||||
const systemSpy = vi.spyOn(permission, "updateAgentSystemPermissions");
|
||||
|
||||
fireEvent.click(screen.getByText("Builder"));
|
||||
|
||||
@ -117,16 +119,24 @@ describe("PermissionsPanel", () => {
|
||||
),
|
||||
).toBeTruthy();
|
||||
|
||||
await waitFor(() => expect(checkbox.disabled).toBe(false));
|
||||
fireEvent.click(checkbox);
|
||||
fireEvent.click(screen.getByRole("button", { name: "Save network" }));
|
||||
const save = screen.getByRole("button", { name: "Save network" });
|
||||
await waitFor(() => expect(save).toHaveProperty("disabled", false));
|
||||
fireEvent.click(save);
|
||||
|
||||
await waitFor(async () => {
|
||||
const doc = await permission.getProjectSystemPermissions(PROJECT_ID);
|
||||
expect(doc.agents?.[0]).toEqual({
|
||||
agentId: expect.any(String),
|
||||
permissions: { crossProjectContactable: true },
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(contactableSpy).toHaveBeenCalledWith(
|
||||
PROJECT_ID,
|
||||
expect.any(String),
|
||||
true,
|
||||
);
|
||||
});
|
||||
await waitFor(async () => {
|
||||
const agents = await agent.listAgents(PROJECT_ID);
|
||||
expect(agents[0].contactable).toBe(true);
|
||||
});
|
||||
expect(systemSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("renders the network control read-only when persisted control says so", async () => {
|
||||
|
||||
Reference in New Issue
Block a user