Add security role route coverage

This commit is contained in:
Dotta committed 2026-04-26 07:44:50 -05:00
1 parent 45071742fb
commit 1c7cec4d96
1 file changed
+33
@@ -436,6 +436,39 @@ describe.sequential("agent skill routes", () => {
);
});
it("accepts the security role on direct agent creation and preserves it in telemetry", async () => {
mockAgentService.update.mockImplementation(async (_id: string, patch: Record<string, unknown>) => ({
...makeAgent("claude_local"),
role: "security",
...patch,
adapterConfig: patch.adapterConfig ?? {},
}));
const res = await requestApp(await createApp(), (baseUrl) => request(baseUrl)
.post("/api/companies/company-1/agents")
.send({
name: "Security Engineer",
role: "security",
adapterType: "claude_local",
adapterConfig: {},
}));
expect([200, 201], JSON.stringify(res.body)).toContain(res.status);
expect(mockAgentService.create).toHaveBeenCalledWith(
"company-1",
expect.objectContaining({
role: "security",
}),
);
expect(mockTrackAgentCreated).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
agentId: "11111111-1111-4111-8111-111111111111",
agentRole: "security",
}),
);
});
it("materializes a managed AGENTS.md for directly created local agents", async () => {
const res = await requestApp(await createApp(), (baseUrl) => request(baseUrl)
.post("/api/companies/company-1/agents")