mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
// Plugin extension import boundary tests enforce plugin extension import rules.
|
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { afterEach, describe, expect, it } from "vitest";
|
|
import {
|
|
collectRetiredWebSearchCorePathEntries,
|
|
main,
|
|
} from "../scripts/check-plugin-extension-import-boundary.mts";
|
|
import { createCapturedIo } from "./helpers/captured-io.js";
|
|
import { useAutoCleanupTempDirTracker } from "./helpers/temp-dir.js";
|
|
|
|
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
|
|
|
|
describe("plugin extension import boundary inventory", () => {
|
|
it("current tree has no plugin extension imports", async () => {
|
|
const captured = createCapturedIo();
|
|
const exitCode = await main(["--json"], captured.io);
|
|
|
|
expect(exitCode).toBe(0);
|
|
expect(captured.readStderr()).toBe("");
|
|
expect(JSON.parse(captured.readStdout())).toEqual([]);
|
|
});
|
|
|
|
it("rejects retired core web-search ownership paths", () => {
|
|
const root = tempDirs.make("openclaw-retired-web-search-");
|
|
const relativeFile = "src/plugins/web-search-providers.mjs";
|
|
const filePath = path.join(root, relativeFile);
|
|
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
writeFileSync(filePath, "export {};\n", "utf8");
|
|
|
|
expect(collectRetiredWebSearchCorePathEntries(root)).toEqual([
|
|
expect.objectContaining({
|
|
file: relativeFile,
|
|
kind: "retired-path",
|
|
}),
|
|
]);
|
|
});
|
|
});
|