test: require codex block reply text · openclaw/openclaw@ce6fca4
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,6 +10,18 @@ function createParams(): EmbeddedRunAttemptParams {
|
10 | 10 | } as unknown as EmbeddedRunAttemptParams; |
11 | 11 | } |
12 | 12 | |
| 13 | +function expectFirstBlockReplyText(params: EmbeddedRunAttemptParams): string { |
| 14 | +const onBlockReply = params.onBlockReply; |
| 15 | +if (onBlockReply === undefined) { |
| 16 | +throw new Error("Expected onBlockReply callback"); |
| 17 | +} |
| 18 | +const payload = vi.mocked(onBlockReply).mock.calls[0]?.[0]; |
| 19 | +if (typeof payload?.text !== "string") { |
| 20 | +throw new Error("Expected first block reply text"); |
| 21 | +} |
| 22 | +return payload.text; |
| 23 | +} |
| 24 | + |
13 | 25 | describe("Codex app-server user input bridge", () => { |
14 | 26 | it("prompts the originating chat and resolves request_user_input from the next queued message", async () => { |
15 | 27 | const params = createParams(); |
@@ -161,9 +173,7 @@ describe("Codex app-server user input bridge", () => {
|
161 | 173 | }); |
162 | 174 | |
163 | 175 | await vi.waitFor(() => expect(params.onBlockReply).toHaveBeenCalledTimes(1)); |
164 | | -const payload = vi.mocked(params.onBlockReply!).mock.calls[0]?.[0]; |
165 | | -expect(payload).toEqual(expect.objectContaining({ text: expect.any(String) })); |
166 | | -const text = payload?.text ?? ""; |
| 176 | +const text = expectFirstBlockReplyText(params); |
167 | 177 | expect(text).toContain("Mode <\uff20U123>"); |
168 | 178 | expect(text).toContain("Pick \uff3btrusted\uff3d\uff08https://evil\uff09 \uff20here"); |
169 | 179 | expect(text).toContain( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -278,7 +278,7 @@ describe("memory index", () => {
|
278 | 278 | if (!result.manager) { |
279 | 279 | throw new Error(missingMessage); |
280 | 280 | } |
281 | | -return result.manager; |
| 281 | +return result.manager as unknown as MemoryIndexManager; |
282 | 282 | } |
283 | 283 | |
284 | 284 | async function getPersistentManager(cfg: TestCfg): Promise<MemoryIndexManager> { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -202,7 +202,7 @@ describe("memory watcher config", () => {
|
202 | 202 | if (!result.manager) { |
203 | 203 | throw new Error("manager missing"); |
204 | 204 | } |
205 | | -manager = result.manager; |
| 205 | +manager = result.manager as unknown as MemoryIndexManager; |
206 | 206 | |
207 | 207 | expect(watchMock).not.toHaveBeenCalled(); |
208 | 208 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -484,10 +484,12 @@ describe("QmdMemoryManager", () => {
|
484 | 484 | }); |
485 | 485 | |
486 | 486 | const { manager } = await createManager({ mode: "full" }); |
487 | | -if (releaseUpdate === null) { |
488 | | -throw new Error("Expected qmd update release callback"); |
489 | | -} |
490 | | -releaseUpdate(); |
| 487 | +( |
| 488 | +releaseUpdate ?? |
| 489 | +(() => { |
| 490 | +throw new Error("Expected qmd update release callback"); |
| 491 | +}) |
| 492 | +)(); |
491 | 493 | await manager?.close(); |
492 | 494 | }); |
493 | 495 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。