Files
openclaw/src/plugins/source-checkout-runtime.test.ts
2026-05-06 01:46:42 +01:00

41 lines
1.2 KiB
TypeScript

import path from "node:path";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { setBundledPluginsDirOverrideForTest } from "./bundled-dir.js";
import { loadOpenClawPlugins } from "./loader.js";
describe("source checkout bundled plugin runtime", () => {
beforeEach(() => {
setBundledPluginsDirOverrideForTest(path.join(process.cwd(), "extensions"));
});
afterEach(() => {
setBundledPluginsDirOverrideForTest(undefined);
});
it("loads enabled bundled plugins from source checkout", () => {
const registry = loadOpenClawPlugins({
cache: false,
onlyPluginIds: ["tokenjuice"],
config: {
plugins: {
entries: {
tokenjuice: { enabled: true },
},
},
},
});
const tokenjuice = registry.plugins.find((plugin) => plugin.id === "tokenjuice");
expect(tokenjuice).toMatchObject({
status: "loaded",
origin: "bundled",
});
const expectedRuntime = `${path.sep}extensions${path.sep}tokenjuice${path.sep}index.ts`;
const expectedRoot = `${path.sep}extensions${path.sep}tokenjuice`;
expect(tokenjuice?.source).toContain(expectedRuntime);
expect(tokenjuice?.rootDir).toContain(expectedRoot);
});
});