mirror of
https://github.com/saltbo/agent-kanban.git
synced 2026-09-19 09:01:47 +08:00
a2fa54a729
Replace the v1 Agent/Machine runtime and CLI architecture with the v2 Resource Server, AMA-backed projections, task lifecycle, session observation, BDD specifications, and a single-package layered codebase. BREAKING CHANGE: remove the v1 CLI, internal Agent/Machine runtime entities, workspace layout, and legacy runtime coordination APIs.
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
// @vitest-environment node
|
|
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import { replaceTaskCancellation, type TaskCancellationRepository } from "../../../server/usecases/tasks/replaceTaskCancellation";
|
|
|
|
describe("Task Cancellation", () => {
|
|
it("cancels a Task without accepting an AMA runtime effect", async () => {
|
|
const repository: TaskCancellationRepository = {
|
|
findTarget: vi.fn(async () => ({
|
|
status: "in_progress",
|
|
assignedTo: "assigned-agent",
|
|
assigneeIdentityType: "realmroot_actor",
|
|
cancellation: null,
|
|
})),
|
|
create: vi.fn(async () => ({
|
|
actionId: "cancel-a",
|
|
actorType: "human",
|
|
actorId: "reviewer-a",
|
|
cancelledAt: "2026-08-31T00:00:00.000Z",
|
|
assigneeActorId: "assigned-agent",
|
|
})),
|
|
};
|
|
|
|
await expect(
|
|
replaceTaskCancellation(repository, {
|
|
ownerId: "tenant-a",
|
|
taskId: "task-a",
|
|
actor: { type: "human", id: "reviewer-a" },
|
|
}),
|
|
).resolves.toMatchObject({ created: true, assigneeActorId: "assigned-agent", cancellation: { cancelledByActorId: "reviewer-a" } });
|
|
expect(repository.create).toHaveBeenCalledOnce();
|
|
});
|
|
});
|