feat(platform): checkpoint current implementation state
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user