perf(test): reduce gateway reload waits and trim duplicate invoke coverage

This commit is contained in:
Peter Steinberger
2026-02-13 23:50:04 +00:00
parent ab71fdf821
commit 4bef423d83
7 changed files with 46 additions and 77 deletions

View File

@@ -164,7 +164,7 @@ describe("block streaming", () => {
});
});
it("falls back to final payloads when block reply send times out", async () => {
it("falls back to final payloads and respects telegram streamMode block", async () => {
await withTempHome(async (home) => {
let sawAbort = false;
const onBlockReply = vi.fn((_, context) => {
@@ -220,32 +220,26 @@ describe("block streaming", () => {
const res = await replyPromise;
expect(res).toMatchObject({ text: "final" });
expect(sawAbort).toBe(true);
});
});
it("does not enable block streaming for telegram streamMode block", async () => {
await withTempHome(async (home) => {
const onBlockReply = vi.fn().mockResolvedValue(undefined);
const impl = async () => ({
const onBlockReplyStreamMode = vi.fn().mockResolvedValue(undefined);
piEmbeddedMock.runEmbeddedPiAgent.mockImplementation(async () => ({
payloads: [{ text: "final" }],
meta: {
durationMs: 5,
agentMeta: { sessionId: "s", provider: "p", model: "m" },
},
});
piEmbeddedMock.runEmbeddedPiAgent.mockImplementation(impl);
}));
const res = await getReplyFromConfig(
const resStreamMode = await getReplyFromConfig(
{
Body: "ping",
From: "+1004",
To: "+2000",
MessageSid: "msg-126",
MessageSid: "msg-127",
Provider: "telegram",
},
{
onBlockReply,
onBlockReply: onBlockReplyStreamMode,
},
{
agents: {
@@ -259,8 +253,8 @@ describe("block streaming", () => {
},
);
expect(res?.text).toBe("final");
expect(onBlockReply).not.toHaveBeenCalled();
expect(resStreamMode?.text).toBe("final");
expect(onBlockReplyStreamMode).not.toHaveBeenCalled();
});
});
});

View File

@@ -102,7 +102,7 @@ describe("RawBody directive parsing", () => {
vi.clearAllMocks();
});
it("detects command directives from RawBody/CommandBody in wrapped group messages", async () => {
it("handles directives, history, and non-default agent session files", async () => {
await withTempHome(async (home) => {
const assertCommandReply = async (input: {
message: ReplyMessage;
@@ -161,11 +161,7 @@ describe("RawBody directive parsing", () => {
},
expectedIncludes: ["Verbose logging enabled."],
});
});
});
it("preserves history and reuses non-default agent session files", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockResolvedValue({
payloads: [{ text: "ok" }],
meta: {