test: tighten onboarding doctor assertions · openclaw/openclaw@cbbbdb3
steipete
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -22,10 +22,13 @@ describe("runDoctorConfigPreflight", () => {
|
22 | 22 | |
23 | 23 | expect(preflight.snapshot.valid).toBe(false); |
24 | 24 | expect(preflight.snapshot.legacyIssues.map((issue) => issue.path)).toContain("memorySearch"); |
25 | | -expect((preflight.baseConfig as { memorySearch?: unknown }).memorySearch).toMatchObject({ |
26 | | -provider: "local", |
27 | | -fallback: "none", |
28 | | -}); |
| 25 | +const memorySearch = ( |
| 26 | +preflight.baseConfig as { |
| 27 | +memorySearch?: { provider?: unknown; fallback?: unknown }; |
| 28 | +} |
| 29 | +).memorySearch; |
| 30 | +expect(memorySearch?.provider).toBe("local"); |
| 31 | +expect(memorySearch?.fallback).toBe("none"); |
29 | 32 | }); |
30 | 33 | }); |
31 | 34 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -218,11 +218,9 @@ describe("noteDevicePairingHealth", () => {
|
218 | 218 | healthOk: true, |
219 | 219 | }); |
220 | 220 | |
221 | | -expect(callGatewayMock).toHaveBeenCalledWith( |
222 | | -expect.objectContaining({ |
223 | | -method: "device.pair.list", |
224 | | -}), |
225 | | -); |
| 221 | +expect(callGatewayMock).toHaveBeenCalledOnce(); |
| 222 | +const [gatewayRequest] = callGatewayMock.mock.calls[0] ?? []; |
| 223 | +expect(gatewayRequest?.method).toBe("device.pair.list"); |
226 | 224 | expect(noteMock).toHaveBeenCalledTimes(1); |
227 | 225 | expect(String(noteMock.mock.calls[0]?.[0] ?? "")).toContain("req-gateway-1"); |
228 | 226 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -145,12 +145,10 @@ describe("promptCustomApiConfig", () => {
|
145 | 145 | |
146 | 146 | await runPromptCustomApi(prompter); |
147 | 147 | |
148 | | -expect(prompter.text).toHaveBeenCalledWith( |
149 | | -expect.objectContaining({ |
150 | | -message: "API Base URL", |
151 | | -initialValue: undefined, |
152 | | -}), |
| 148 | +const apiBaseUrlCall = prompter.text.mock.calls.find( |
| 149 | +([options]) => options.message === "API Base URL", |
153 | 150 | ); |
| 151 | +expect(apiBaseUrlCall?.[0].initialValue).toBeUndefined(); |
154 | 152 | }); |
155 | 153 | |
156 | 154 | it("retries when verification fails", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -104,7 +104,7 @@ describe("openUrl", () => {
|
104 | 104 | expect(mocks.runCommandWithTimeout).toHaveBeenCalledTimes(1); |
105 | 105 | const [argv, options] = mocks.runCommandWithTimeout.mock.calls[0] ?? []; |
106 | 106 | expect(argv).toEqual([rundll32, "url.dll,FileProtocolHandler", url]); |
107 | | -expect(options).toMatchObject({ timeoutMs: 5_000 }); |
| 107 | +expect(options?.timeoutMs).toBe(5_000); |
108 | 108 | expect(options?.windowsVerbatimArguments).toBeUndefined(); |
109 | 109 | |
110 | 110 | platformSpy.mockRestore(); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -184,6 +184,6 @@ describe("setupSkills", () => {
|
184 | 184 | await setupSkills({} as OpenClawConfig, "/tmp/ws", runtime, prompter); |
185 | 185 | |
186 | 186 | const brewNote = notes.find((n) => n.title === "Homebrew recommended"); |
187 | | -expect(brewNote).toMatchObject({ title: "Homebrew recommended" }); |
| 187 | +expect(brewNote?.title).toBe("Homebrew recommended"); |
188 | 188 | }); |
189 | 189 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。