test: guard sdk status mock call · openclaw/openclaw@b4b4a77
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -44,6 +44,14 @@ function expectResolvedReasoningLevel(value: unknown, expected: string) {
|
44 | 44 | expect((value as { resolvedReasoningLevel?: unknown }).resolvedReasoningLevel).toBe(expected); |
45 | 45 | } |
46 | 46 | |
| 47 | +function requireBuildStatusReplyParams(index = 0): unknown { |
| 48 | +const call = buildStatusReply.mock.calls.at(index); |
| 49 | +if (!call) { |
| 50 | +throw new Error(`expected buildStatusReply call ${index}`); |
| 51 | +} |
| 52 | +return call[0]; |
| 53 | +} |
| 54 | + |
47 | 55 | describe("resolveDirectStatusReplyForSession", () => { |
48 | 56 | beforeEach(() => { |
49 | 57 | buildStatusReply.mockReset(); |
@@ -100,7 +108,7 @@ describe("resolveDirectStatusReplyForSession", () => {
|
100 | 108 | }); |
101 | 109 | |
102 | 110 | expect(buildStatusReply).toHaveBeenCalledOnce(); |
103 | | -expectResolvedReasoningLevel(buildStatusReply.mock.calls[0]?.[0], "off"); |
| 111 | +expectResolvedReasoningLevel(requireBuildStatusReplyParams(), "off"); |
104 | 112 | expectResolvedReasoningLevel(result, "off"); |
105 | 113 | }); |
106 | 114 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。