Spaces:
Paused
Paused
File size: 1,765 Bytes
c1243f9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import { describe, expect, it } from "vitest";
import { formatPluginSourceForTable } from "./source-display.js";
describe("formatPluginSourceForTable", () => {
it("shortens bundled plugin sources under the stock root", () => {
const out = formatPluginSourceForTable(
{
origin: "bundled",
source: "/opt/homebrew/lib/node_modules/openclaw/extensions/bluebubbles/index.ts",
},
{
stock: "/opt/homebrew/lib/node_modules/openclaw/extensions",
global: "/Users/x/.openclaw/extensions",
workspace: "/Users/x/ws/.openclaw/extensions",
},
);
expect(out.value).toBe("stock:bluebubbles/index.ts");
expect(out.rootKey).toBe("stock");
});
it("shortens workspace plugin sources under the workspace root", () => {
const out = formatPluginSourceForTable(
{
origin: "workspace",
source: "/Users/x/ws/.openclaw/extensions/matrix/index.ts",
},
{
stock: "/opt/homebrew/lib/node_modules/openclaw/extensions",
global: "/Users/x/.openclaw/extensions",
workspace: "/Users/x/ws/.openclaw/extensions",
},
);
expect(out.value).toBe("workspace:matrix/index.ts");
expect(out.rootKey).toBe("workspace");
});
it("shortens global plugin sources under the global root", () => {
const out = formatPluginSourceForTable(
{
origin: "global",
source: "/Users/x/.openclaw/extensions/zalo/index.js",
},
{
stock: "/opt/homebrew/lib/node_modules/openclaw/extensions",
global: "/Users/x/.openclaw/extensions",
workspace: "/Users/x/ws/.openclaw/extensions",
},
);
expect(out.value).toBe("global:zalo/index.js");
expect(out.rootKey).toBe("global");
});
});
|