test: refresh auto-reply expectations

This commit is contained in:
Peter Steinberger
2026-01-03 05:09:59 +01:00
parent 0ed5b82389
commit 988b67aa30
4 changed files with 15 additions and 10 deletions

View File

@@ -116,7 +116,11 @@ describe("directive parsing", () => {
vi.mocked(runEmbeddedPiAgent).mockReset(); vi.mocked(runEmbeddedPiAgent).mockReset();
const res = await getReplyFromConfig( const res = await getReplyFromConfig(
{ Body: "/queue collect debounce:bogus cap:zero drop:maybe", From: "+1222", To: "+1222" }, {
Body: "/queue collect debounce:bogus cap:zero drop:maybe",
From: "+1222",
To: "+1222",
},
{}, {},
{ {
agent: { agent: {

View File

@@ -42,9 +42,8 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
process.env.HOME = previousHome; process.env.HOME = previousHome;
try { try {
await fs.rm(base, { recursive: true, force: true }); await fs.rm(base, { recursive: true, force: true });
} catch (err) { } catch {
const msg = err instanceof Error ? err.message : String(err); // ignore cleanup failures in tests
if (!msg.includes("ENOTEMPTY")) throw err;
} }
} }
} }
@@ -105,9 +104,7 @@ describe("queue followups", () => {
cfg, cfg,
); );
const secondText = Array.isArray(second) const secondText = Array.isArray(second) ? second[0]?.text : second?.text;
? second[0]?.text
: second?.text;
expect(secondText).toBe("main"); expect(secondText).toBe("main");
await vi.runAllTimersAsync(); await vi.runAllTimersAsync();

View File

@@ -450,6 +450,8 @@ describe("trigger handling", () => {
}); });
describe("group intro prompts", () => { describe("group intro prompts", () => {
const groupParticipationNote =
"Be a good group participant: lurk and follow the conversation, but only chime in when you have something genuinely helpful or relevant to add. Don't feel obligated to respond to every message — quality over quantity. Even when lurking silently, you can use emoji reactions to acknowledge messages, show support, or react to humor — reactions are always appreciated and don't clutter the chat.";
it("labels Discord groups using the surface metadata", async () => { it("labels Discord groups using the surface metadata", async () => {
await withTempHome(async (home) => { await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockResolvedValue({ vi.mocked(runEmbeddedPiAgent).mockResolvedValue({
@@ -479,7 +481,7 @@ describe("group intro prompts", () => {
vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0]
?.extraSystemPrompt ?? ""; ?.extraSystemPrompt ?? "";
expect(extraSystemPrompt).toBe( expect(extraSystemPrompt).toBe(
'You are replying inside the Discord group "Release Squad". Group members: Alice, Bob. Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). Address the specific sender noted in the message context.', `You are replying inside the Discord group "Release Squad". Group members: Alice, Bob. Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). ${groupParticipationNote} Address the specific sender noted in the message context.`,
); );
}); });
}); });
@@ -512,7 +514,7 @@ describe("group intro prompts", () => {
vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0]
?.extraSystemPrompt ?? ""; ?.extraSystemPrompt ?? "";
expect(extraSystemPrompt).toBe( expect(extraSystemPrompt).toBe(
'You are replying inside the WhatsApp group "Ops". Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). Address the specific sender noted in the message context.', `You are replying inside the WhatsApp group "Ops". Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). ${groupParticipationNote} Address the specific sender noted in the message context.`,
); );
}); });
}); });
@@ -545,7 +547,7 @@ describe("group intro prompts", () => {
vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0]
?.extraSystemPrompt ?? ""; ?.extraSystemPrompt ?? "";
expect(extraSystemPrompt).toBe( expect(extraSystemPrompt).toBe(
'You are replying inside the Telegram group "Dev Chat". Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). Address the specific sender noted in the message context.', `You are replying inside the Telegram group "Dev Chat". Activation: trigger-only (you are invoked only when explicitly mentioned; recent context may be included). ${groupParticipationNote} Address the specific sender noted in the message context.`,
); );
}); });
}); });

View File

@@ -8,6 +8,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
vi.mock("../agents/pi-embedded.js", () => ({ vi.mock("../agents/pi-embedded.js", () => ({
abortEmbeddedPiRun: vi.fn().mockReturnValue(false), abortEmbeddedPiRun: vi.fn().mockReturnValue(false),
isEmbeddedPiRunActive: vi.fn().mockReturnValue(false),
isEmbeddedPiRunStreaming: vi.fn().mockReturnValue(false),
runEmbeddedPiAgent: vi.fn(), runEmbeddedPiAgent: vi.fn(),
queueEmbeddedPiMessage: vi.fn().mockReturnValue(false), queueEmbeddedPiMessage: vi.fn().mockReturnValue(false),
resolveEmbeddedSessionLane: (key: string) => resolveEmbeddedSessionLane: (key: string) =>