test: guard cron live-session retry call · openclaw/openclaw@07e3fd5
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -65,7 +65,25 @@ function makeSuccessfulRunResult(modelUsed = "claude-sonnet-4-6") {
|
65 | 65 | }; |
66 | 66 | } |
67 | 67 | |
68 | | -// ---------- tests ---------- |
| 68 | +function requireEmbeddedAgentCall(index: number): { |
| 69 | +provider?: string; |
| 70 | +model?: string; |
| 71 | +authProfileId?: string; |
| 72 | +authProfileIdSource?: string; |
| 73 | +} { |
| 74 | +const call = runEmbeddedPiAgentMock.mock.calls[index]?.[0] as |
| 75 | +| { |
| 76 | +provider?: string; |
| 77 | +model?: string; |
| 78 | +authProfileId?: string; |
| 79 | +authProfileIdSource?: string; |
| 80 | +} |
| 81 | +| undefined; |
| 82 | +if (!call) { |
| 83 | +throw new Error(`Expected embedded PI agent call ${index}`); |
| 84 | +} |
| 85 | +return call; |
| 86 | +} |
69 | 87 | |
70 | 88 | describe("runCronIsolatedAgentTurn — LiveSessionModelSwitchError retry (#57206)", () => { |
71 | 89 | let previousFastTestEnv: string | undefined; |
@@ -207,11 +225,11 @@ describe("runCronIsolatedAgentTurn — LiveSessionModelSwitchError retry (#57206
|
207 | 225 | |
208 | 226 | expect(result.status).toBe("ok"); |
209 | 227 | expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(2); |
210 | | -const retryParams = runEmbeddedPiAgentMock.mock.calls[1]?.[0]; |
211 | | -expect(retryParams?.provider).toBe("anthropic"); |
212 | | -expect(retryParams?.model).toBe("claude-sonnet-4-6"); |
213 | | -expect(retryParams?.authProfileId).toBe("profile-b"); |
214 | | -expect(retryParams?.authProfileIdSource).toBe("user"); |
| 228 | +const retryParams = requireEmbeddedAgentCall(1); |
| 229 | +expect(retryParams.provider).toBe("anthropic"); |
| 230 | +expect(retryParams.model).toBe("claude-sonnet-4-6"); |
| 231 | +expect(retryParams.authProfileId).toBe("profile-b"); |
| 232 | +expect(retryParams.authProfileIdSource).toBe("user"); |
215 | 233 | expect(cronSession.sessionEntry.authProfileOverride).toBe("profile-b"); |
216 | 234 | expect(cronSession.sessionEntry.authProfileOverrideSource).toBe("user"); |
217 | 235 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。