test: narrow doctor command warning coverage

This commit is contained in:
Peter Steinberger
2026-04-10 16:49:55 +01:00
parent eddbc04f4b
commit 74f25c0e88

View File

@@ -1,22 +1,22 @@
import { describe, expect, it, vi } from "vitest";
import { withTempHomeConfig } from "../config/test-helpers.js";
import { note } from "../terminal/note.js";
import { noteIncludeConfinementWarning } from "./doctor-config-analysis.js";
vi.mock("../terminal/note.js", () => ({
note: vi.fn(),
}));
import { loadAndMaybeMigrateDoctorConfig } from "./doctor-config-flow.js";
const noteSpy = vi.mocked(note);
describe("doctor include warning", () => {
it("surfaces include confinement hint for escaped include paths", async () => {
await withTempHomeConfig({ $include: "/etc/passwd" }, async () => {
await loadAndMaybeMigrateDoctorConfig({
options: { nonInteractive: true },
confirm: async () => false,
});
it("surfaces include confinement hint for escaped include paths", () => {
noteIncludeConfinementWarning({
path: "/tmp/openclaw-config/openclaw.json",
issues: [
{
message: "Include path escapes config directory: /etc/passwd",
},
],
});
expect(noteSpy).toHaveBeenCalledWith(