feat(platform): checkpoint current implementation state

This commit is contained in:
2026-04-01 07:42:03 +02:00
parent 3e53471f05
commit 8c5be51251
125 changed files with 10269 additions and 17808 deletions
@@ -108,4 +108,68 @@ describe("assistant project admin update tools", () => {
error: "Project not found with the given criteria.",
});
});
it("returns a stable assistant error when no update fields are provided", async () => {
const projectUpdate = vi.fn();
const ctx = createToolContext(
{
project: {
findUnique: vi.fn()
.mockResolvedValueOnce(null)
.mockResolvedValueOnce(createProject()),
findFirst: vi.fn().mockResolvedValue(null),
update: projectUpdate,
},
},
{
userRole: SystemRole.ADMIN,
permissions: [PermissionKey.MANAGE_PROJECTS],
},
);
const result = await executeTool(
"update_project",
JSON.stringify({ id: "PROJ-1" }),
ctx,
);
expect(JSON.parse(result.content)).toEqual({
error: "No fields to update",
});
expect(projectUpdate).not.toHaveBeenCalled();
});
it("returns responsible person resolver errors unchanged during update", async () => {
const projectUpdate = vi.fn();
const ctx = createToolContext(
{
project: {
findUnique: vi.fn()
.mockResolvedValueOnce(null)
.mockResolvedValueOnce(createProject()),
findFirst: vi.fn().mockResolvedValue(null),
update: projectUpdate,
},
resource: {
findFirst: vi.fn().mockResolvedValue(null),
findMany: vi.fn().mockResolvedValue([]),
},
},
{
userRole: SystemRole.ADMIN,
permissions: [PermissionKey.MANAGE_PROJECTS],
},
);
const result = await executeTool(
"update_project",
JSON.stringify({ id: "PROJ-1", responsiblePerson: "Mary Jane" }),
ctx,
);
expect(JSON.parse(result.content)).toEqual({
error: 'No active resource found matching "Mary Jane". The responsible person must be an existing resource.',
});
expect(projectUpdate).not.toHaveBeenCalled();
});
});