mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 06:10:21 +00:00
perf(test): fold tool-policy + doctor workspace entrypoints
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user