evOo-local/apps/api/src/runs.test.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

40 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { activityNotificationsEnabled, activityPromptSnippet } from "./runs.js";
describe("run activity copy", () => {
it("presents structured agent messages instead of their internal wake prompt", () => {
expect(
activityPromptSnippet({
trigger: "bot_message",
prompt: "[bot] A message just arrived from another bot with internal routing data",
sourceBlocks: [
{
kind: "bot_message_received",
fromBotId: "maya",
fromBotName: "Maya",
text: "Please check the release workflow.",
intent: "request",
},
],
}),
).toBe("Maya asked: Please check the release workflow.");
});
it("fails closed when an agent message has no valid structured source", () => {
expect(
activityPromptSnippet({
trigger: "bot_message",
prompt: "[bot] private internal routing envelope",
sourceBlocks: [{ kind: "text", text: "not a peer message" }],
}),
).toBe("Message from another agent");
});
});
describe("run activity notification preference", () => {
it("silences only direct messages", () => {
expect(activityNotificationsEnabled(null, false)).toBe(false);
expect(activityNotificationsEnabled("group-1", false)).toBe(true);
});
});