test: assert block reply chunk payloads · openclaw/openclaw@1d3ab90
shakkernerd
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,7 +21,11 @@ describe("subscribeEmbeddedPiSession", () => {
|
21 | 21 | emitAssistantTextDeltaAndEnd({ emit, text }); |
22 | 22 | |
23 | 23 | expect(onBlockReply).toHaveBeenCalledTimes(3); |
24 | | -expect(onBlockReply.mock.calls[1][0].text).toBe(" ```js\n const x = 1;\n ```"); |
| 24 | +expect(extractTextPayloads(onBlockReply.mock.calls)).toEqual([ |
| 25 | +"Intro", |
| 26 | +" ```js\n const x = 1;\n ```", |
| 27 | +"Outro", |
| 28 | +]); |
25 | 29 | }); |
26 | 30 | it("accepts longer fence markers for close", () => { |
27 | 31 | const onBlockReply = vi.fn(); |
@@ -38,13 +42,6 @@ describe("subscribeEmbeddedPiSession", () => {
|
38 | 42 | emitAssistantTextDeltaAndEnd({ emit, text }); |
39 | 43 | |
40 | 44 | const payloadTexts = extractTextPayloads(onBlockReply.mock.calls); |
41 | | -expect(payloadTexts.length).toBeGreaterThan(0); |
42 | | -const combined = payloadTexts.join(" ").replace(/\s+/g, " ").trim(); |
43 | | -expect(combined).toContain("````md"); |
44 | | -expect(combined).toContain("line1"); |
45 | | -expect(combined).toContain("line2"); |
46 | | -expect(combined).toContain("````"); |
47 | | -expect(combined).toContain("Intro"); |
48 | | -expect(combined).toContain("Outro"); |
| 45 | +expect(payloadTexts).toEqual(["Intro", "````md\nline1\nline2\n````", "Outro"]); |
49 | 46 | }); |
50 | 47 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。