Files
boss/tests/master-agent-complete-route-nonblocking.test.ts
2026-06-08 12:22:50 +08:00

22 lines
738 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
test("master agent complete route does not block completion response on Telegram delivery", async () => {
const source = await readFile(
new URL("../src/app/api/v1/master-agent/tasks/[taskId]/complete/route.ts", import.meta.url),
"utf8",
);
assert.doesNotMatch(
source,
/await\s+deliverTelegramReplyForCompletedTask/,
"task completion must not wait for Telegram delivery before returning to local-agent",
);
assert.match(
source,
/void\s+deliverTelegramReplyForCompletedTask/,
"expected Telegram delivery to be scheduled in the background after the task is persisted",
);
});