test: tighten provider usage plugin assertions · openclaw/openclaw@e5a1022
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -60,15 +60,23 @@ describe("provider-usage.load plugin boundary", () => {
|
60 | 60 | }); |
61 | 61 | |
62 | 62 | expect(mockFetch).not.toHaveBeenCalled(); |
63 | | -expect(resolveProviderUsageSnapshotWithPluginMock).toHaveBeenCalledWith( |
64 | | -expect.objectContaining({ |
65 | | -provider: "github-copilot", |
66 | | -context: expect.objectContaining({ |
67 | | -provider: "github-copilot", |
68 | | -token: "copilot-token", |
69 | | -timeoutMs: 5_000, |
70 | | -}), |
71 | | -}), |
72 | | -); |
| 63 | +expect(resolveProviderUsageSnapshotWithPluginMock).toHaveBeenCalledOnce(); |
| 64 | +const pluginCall = resolveProviderUsageSnapshotWithPluginMock.mock.calls[0]?.[0] as |
| 65 | +| { |
| 66 | +provider?: unknown; |
| 67 | +context?: { |
| 68 | +provider?: unknown; |
| 69 | +token?: unknown; |
| 70 | +timeoutMs?: unknown; |
| 71 | +}; |
| 72 | +} |
| 73 | +| undefined; |
| 74 | +if (!pluginCall) { |
| 75 | +throw new Error("missing provider usage plugin call"); |
| 76 | +} |
| 77 | +expect(pluginCall.provider).toBe("github-copilot"); |
| 78 | +expect(pluginCall.context?.provider).toBe("github-copilot"); |
| 79 | +expect(pluginCall.context?.token).toBe("copilot-token"); |
| 80 | +expect(pluginCall.context?.timeoutMs).toBe(5_000); |
73 | 81 | }); |
74 | 82 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。