perf(test): fold tool-policy + doctor workspace entrypoints

This commit is contained in:
Peter Steinberger
2026-02-16 01:09:07 +00:00
parent 5fe47e7be6
commit f142048293
4 changed files with 22 additions and 25 deletions

View File

@@ -1,13 +0,0 @@
import { describe, expect, test } from "vitest";
import { TOOL_POLICY_CONFORMANCE } from "./tool-policy.conformance.js";
import { TOOL_GROUPS } from "./tool-policy.js";
describe("TOOL_POLICY_CONFORMANCE", () => {
test("matches exported TOOL_GROUPS exactly", () => {
expect(TOOL_POLICY_CONFORMANCE.toolGroups).toEqual(TOOL_GROUPS);
});
test("is JSON-serializable", () => {
expect(() => JSON.stringify(TOOL_POLICY_CONFORMANCE)).not.toThrow();
});
});

View File

@@ -1,4 +1,5 @@
import { describe, expect, it } from "vitest";
import { TOOL_POLICY_CONFORMANCE } from "./tool-policy.conformance.js";
import { expandToolGroups, resolveToolProfilePolicy, TOOL_GROUPS } from "./tool-policy.js";
describe("tool-policy", () => {
@@ -28,3 +29,13 @@ describe("tool-policy", () => {
expect(group).toContain("session_status");
});
});
describe("TOOL_POLICY_CONFORMANCE", () => {
it("matches exported TOOL_GROUPS exactly", () => {
expect(TOOL_POLICY_CONFORMANCE.toolGroups).toEqual(TOOL_GROUPS);
});
it("is JSON-serializable", () => {
expect(() => JSON.stringify(TOOL_POLICY_CONFORMANCE)).not.toThrow();
});
});

View File

@@ -1,3 +1,4 @@
import path from "node:path";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
@@ -25,6 +26,7 @@ vi.mock("../agents/model-auth.js", () => ({
}));
import { noteMemorySearchHealth } from "./doctor-memory-search.js";
import { detectLegacyWorkspaceDirs } from "./doctor-workspace.js";
describe("noteMemorySearchHealth", () => {
const cfg = {} as OpenClawConfig;
@@ -85,3 +87,12 @@ describe("noteMemorySearchHealth", () => {
expect(note).not.toHaveBeenCalled();
});
});
describe("detectLegacyWorkspaceDirs", () => {
it("returns active workspace and no legacy dirs", () => {
const workspaceDir = "/home/user/openclaw";
const detection = detectLegacyWorkspaceDirs({ workspaceDir });
expect(detection.activeWorkspace).toBe(path.resolve(workspaceDir));
expect(detection.legacyDirs).toEqual([]);
});
});

View File

@@ -1,12 +0,0 @@
import path from "node:path";
import { describe, expect, it } from "vitest";
import { detectLegacyWorkspaceDirs } from "./doctor-workspace.js";
describe("detectLegacyWorkspaceDirs", () => {
it("returns active workspace and no legacy dirs", () => {
const workspaceDir = "/home/user/openclaw";
const detection = detectLegacyWorkspaceDirs({ workspaceDir });
expect(detection.activeWorkspace).toBe(path.resolve(workspaceDir));
expect(detection.legacyDirs).toEqual([]);
});
});