test: dedupe codex projector mock reads · openclaw/openclaw@936989a
steipete
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -431,7 +431,8 @@ describe("CodexAppServerEventProjector", () => {
|
431 | 431 | }, |
432 | 432 | }), |
433 | 433 | ); |
434 | | -const toolProgressText = onToolResult.mock.calls.at(0)?.[0]?.text; |
| 434 | +const toolProgressText = (mockCallArg(onToolResult, 0, 0, "onToolResult") as { text?: string }) |
| 435 | +.text; |
435 | 436 | expect(toolProgressText).toBe("🛠️ `run tests (workspace)`"); |
436 | 437 | |
437 | 438 | await projector.handleNotification( |
@@ -1457,7 +1458,7 @@ describe("CodexAppServerEventProjector", () => {
|
1457 | 1458 | }), |
1458 | 1459 | ); |
1459 | 1460 | |
1460 | | -const text = onToolResult.mock.calls.at(0)?.[0]?.text; |
| 1461 | +const text = (mockCallArg(onToolResult, 0, 0, "onToolResult") as { text?: string }).text; |
1461 | 1462 | expect(text).toContain("sk-123…ZZZZ"); |
1462 | 1463 | expect(text).not.toContain("sk-1234567890abcdefZZZZ"); |
1463 | 1464 | }); |
@@ -1589,7 +1590,10 @@ describe("CodexAppServerEventProjector", () => {
|
1589 | 1590 | ); |
1590 | 1591 | |
1591 | 1592 | expect(onToolResult).toHaveBeenCalledTimes(21); |
1592 | | -expect(onToolResult.mock.calls.at(19)?.[0]?.text).toContain("...(truncated)..."); |
| 1593 | +const truncatedOutput = mockCallArg(onToolResult, 19, 0, "onToolResult") as { |
| 1594 | +text?: string; |
| 1595 | +}; |
| 1596 | +expect(truncatedOutput.text).toContain("...(truncated)..."); |
1593 | 1597 | expect(JSON.stringify(onToolResult.mock.calls)).not.toContain( |
1594 | 1598 | "final output should not duplicate", |
1595 | 1599 | ); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。