Files
saltbo__agent-kanban/tests/unit/application/task-cancellation-application.test.ts
jarvis a2fa54a729 feat!: rebuild Agent Kanban for Realmroot Toolbox
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.
2026-09-02 00:17:52 -04:00

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();
});
});