test: tighten gateway helper call assertions · openclaw/openclaw@344f42a
steipete
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -136,12 +136,8 @@ describe("runBootOnce", () => {
|
136 | 136 | |
137 | 137 | expect(agentCommand).toHaveBeenCalledTimes(1); |
138 | 138 | const call = agentCommand.mock.calls[0]?.[0]; |
139 | | -expect(call).toEqual( |
140 | | -expect.objectContaining({ |
141 | | -deliver: false, |
142 | | -sessionKey: resolveMainSessionKey({}), |
143 | | -}), |
144 | | -); |
| 139 | +expect(call?.deliver).toBe(false); |
| 140 | +expect(call?.sessionKey).toBe(resolveMainSessionKey({})); |
145 | 141 | expect(call?.message).toContain("BOOT.md:"); |
146 | 142 | expect(call?.message).toContain(content); |
147 | 143 | expect(call?.message).toContain("NO_REPLY"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -159,13 +159,11 @@ describe("handleGatewayPostJsonEndpoint", () => {
|
159 | 159 | }, |
160 | 160 | ); |
161 | 161 | |
162 | | -expect(resolveOperatorScopes).toHaveBeenCalledWith( |
163 | | -expect.anything(), |
164 | | -expect.objectContaining({ |
165 | | -authMethod: "token", |
166 | | -trustDeclaredOperatorScopes: false, |
167 | | -}), |
168 | | -); |
| 162 | +const [, requestAuth] = (resolveOperatorScopes.mock.calls[0] as unknown as |
| 163 | +| [IncomingMessage, { authMethod?: string; trustDeclaredOperatorScopes: boolean }] |
| 164 | +| undefined) ?? [undefined, undefined]; |
| 165 | +expect(requestAuth?.authMethod).toBe("token"); |
| 166 | +expect(requestAuth?.trustDeclaredOperatorScopes).toBe(false); |
169 | 167 | expect(result).toEqual({ |
170 | 168 | body: { ok: true }, |
171 | 169 | requestAuth: { authMethod: "token", trustDeclaredOperatorScopes: false }, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。