test: tighten onboarding doctor assertions

This commit is contained in:
Peter Steinberger
2026-05-10 00:36:18 +01:00
parent e9373925bb
commit cbbbdb37eb
5 changed files with 15 additions and 16 deletions
+7 -4
View File
@@ -22,10 +22,13 @@ describe("runDoctorConfigPreflight", () => {
expect(preflight.snapshot.valid).toBe(false);
expect(preflight.snapshot.legacyIssues.map((issue) => issue.path)).toContain("memorySearch");
expect((preflight.baseConfig as { memorySearch?: unknown }).memorySearch).toMatchObject({
provider: "local",
fallback: "none",
});
const memorySearch = (
preflight.baseConfig as {
memorySearch?: { provider?: unknown; fallback?: unknown };
}
).memorySearch;
expect(memorySearch?.provider).toBe("local");
expect(memorySearch?.fallback).toBe("none");
});
});
+3 -5
View File
@@ -218,11 +218,9 @@ describe("noteDevicePairingHealth", () => {
healthOk: true,
});
expect(callGatewayMock).toHaveBeenCalledWith(
expect.objectContaining({
method: "device.pair.list",
}),
);
expect(callGatewayMock).toHaveBeenCalledOnce();
const [gatewayRequest] = callGatewayMock.mock.calls[0] ?? [];
expect(gatewayRequest?.method).toBe("device.pair.list");
expect(noteMock).toHaveBeenCalledTimes(1);
expect(String(noteMock.mock.calls[0]?.[0] ?? "")).toContain("req-gateway-1");
});
+3 -5
View File
@@ -145,12 +145,10 @@ describe("promptCustomApiConfig", () => {
await runPromptCustomApi(prompter);
expect(prompter.text).toHaveBeenCalledWith(
expect.objectContaining({
message: "API Base URL",
initialValue: undefined,
}),
const apiBaseUrlCall = prompter.text.mock.calls.find(
([options]) => options.message === "API Base URL",
);
expect(apiBaseUrlCall?.[0].initialValue).toBeUndefined();
});
it("retries when verification fails", async () => {
+1 -1
View File
@@ -104,7 +104,7 @@ describe("openUrl", () => {
expect(mocks.runCommandWithTimeout).toHaveBeenCalledTimes(1);
const [argv, options] = mocks.runCommandWithTimeout.mock.calls[0] ?? [];
expect(argv).toEqual([rundll32, "url.dll,FileProtocolHandler", url]);
expect(options).toMatchObject({ timeoutMs: 5_000 });
expect(options?.timeoutMs).toBe(5_000);
expect(options?.windowsVerbatimArguments).toBeUndefined();
platformSpy.mockRestore();
+1 -1
View File
@@ -184,6 +184,6 @@ describe("setupSkills", () => {
await setupSkills({} as OpenClawConfig, "/tmp/ws", runtime, prompter);
const brewNote = notes.find((n) => n.title === "Homebrew recommended");
expect(brewNote).toMatchObject({ title: "Homebrew recommended" });
expect(brewNote?.title).toBe("Homebrew recommended");
});
});