vicky469_aside/tests/agentDirectives.test.ts
2026-06-02 23:18:29 +08:00

39 lines
1.3 KiB
TypeScript

import * as assert from "node:assert/strict";
import test from "node:test";
import { parseAgentDirectives } from "../src/core/text/agentDirectives";
test("parseAgentDirectives resolves a single explicit target", () => {
assert.deepEqual(parseAgentDirectives("Please ask @codex to handle this."), {
target: "codex",
hasConflict: false,
matchedTargets: ["codex"],
unsupportedTargets: [],
});
});
test("parseAgentDirectives ignores repeated mentions of the same supported target", () => {
assert.deepEqual(parseAgentDirectives("@codex please review this for @codex"), {
target: "codex",
hasConflict: false,
matchedTargets: ["codex"],
unsupportedTargets: [],
});
});
test("parseAgentDirectives resolves claude as a supported peer target", () => {
assert.deepEqual(parseAgentDirectives("ping foo@example.com then ask @claude"), {
target: "claude",
hasConflict: false,
matchedTargets: ["claude"],
unsupportedTargets: [],
});
});
test("parseAgentDirectives blocks mixed supported agent mentions", () => {
assert.deepEqual(parseAgentDirectives("ask @codex and @claude"), {
target: null,
hasConflict: true,
matchedTargets: ["codex", "claude"],
unsupportedTargets: [],
});
});