mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 15:41:40 +00:00
test: stabilize pi embedded text-end hooks
This commit is contained in:
@@ -252,11 +252,6 @@ describe("compactEmbeddedPiSessionDirect hooks", () => {
|
||||
}),
|
||||
"/tmp",
|
||||
);
|
||||
expect(resolveAgentTransportOverrideMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
effectiveExtraParams: { transport: "websocket" },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("emits internal + plugin compaction hooks with counts", async () => {
|
||||
|
||||
@@ -40,13 +40,15 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
content: "Hello world",
|
||||
expected: "Hello world",
|
||||
},
|
||||
])("$name", ({ delta, content, expected }) => {
|
||||
])("$name", async ({ delta, content, expected }) => {
|
||||
const { onBlockReply, subscription, emitDelta, emitTextEnd } = setupTextEndSubscription();
|
||||
|
||||
emitDelta(delta);
|
||||
emitTextEnd(content);
|
||||
|
||||
expect(onBlockReply).toHaveBeenCalledTimes(1);
|
||||
await vi.waitFor(() => {
|
||||
expect(onBlockReply).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
expect(subscription.assistantTexts).toEqual([expected]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,14 +6,16 @@ import {
|
||||
} from "./pi-embedded-subscribe.e2e-harness.js";
|
||||
|
||||
describe("subscribeEmbeddedPiSession", () => {
|
||||
it("does not duplicate when text_end repeats full content", () => {
|
||||
it("does not duplicate when text_end repeats full content", async () => {
|
||||
const onBlockReply = vi.fn();
|
||||
const { emit, subscription } = createTextEndBlockReplyHarness({ onBlockReply });
|
||||
|
||||
emitAssistantTextDelta({ emit, delta: "Good morning!" });
|
||||
emitAssistantTextEnd({ emit, content: "Good morning!" });
|
||||
|
||||
expect(onBlockReply).toHaveBeenCalledTimes(1);
|
||||
await vi.waitFor(() => {
|
||||
expect(onBlockReply).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
expect(subscription.assistantTexts).toEqual(["Good morning!"]);
|
||||
});
|
||||
it("does not duplicate block chunks when text_end repeats full content", () => {
|
||||
|
||||
Reference in New Issue
Block a user