mirror of https://github.com/openclaw/openclaw.git
68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
import { execFileSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import { collectExtensionPluginSdkBoundaryInventory } from "../scripts/check-extension-plugin-sdk-boundary.mjs";
|
|
|
|
const repoRoot = process.cwd();
|
|
const scriptPath = path.join(repoRoot, "scripts", "check-extension-plugin-sdk-boundary.mjs");
|
|
|
|
describe("extension src outside plugin-sdk boundary inventory", () => {
|
|
it("is currently empty", async () => {
|
|
const inventory = await collectExtensionPluginSdkBoundaryInventory("src-outside-plugin-sdk");
|
|
|
|
expect(inventory).toEqual([]);
|
|
});
|
|
|
|
it("produces stable sorted output", async () => {
|
|
const first = await collectExtensionPluginSdkBoundaryInventory("src-outside-plugin-sdk");
|
|
const second = await collectExtensionPluginSdkBoundaryInventory("src-outside-plugin-sdk");
|
|
|
|
expect(second).toEqual(first);
|
|
expect(
|
|
[...first].toSorted(
|
|
(left, right) =>
|
|
left.file.localeCompare(right.file) ||
|
|
left.line - right.line ||
|
|
left.kind.localeCompare(right.kind) ||
|
|
left.specifier.localeCompare(right.specifier) ||
|
|
left.resolvedPath.localeCompare(right.resolvedPath) ||
|
|
left.reason.localeCompare(right.reason),
|
|
),
|
|
).toEqual(first);
|
|
});
|
|
|
|
it("script json output is empty", () => {
|
|
const stdout = execFileSync(
|
|
process.execPath,
|
|
[scriptPath, "--mode=src-outside-plugin-sdk", "--json"],
|
|
{
|
|
cwd: repoRoot,
|
|
encoding: "utf8",
|
|
},
|
|
);
|
|
|
|
expect(JSON.parse(stdout)).toEqual([]);
|
|
});
|
|
});
|
|
|
|
describe("extension plugin-sdk-internal boundary inventory", () => {
|
|
it("is currently empty", async () => {
|
|
const inventory = await collectExtensionPluginSdkBoundaryInventory("plugin-sdk-internal");
|
|
|
|
expect(inventory).toEqual([]);
|
|
});
|
|
|
|
it("script json output is empty", () => {
|
|
const stdout = execFileSync(
|
|
process.execPath,
|
|
[scriptPath, "--mode=plugin-sdk-internal", "--json"],
|
|
{
|
|
cwd: repoRoot,
|
|
encoding: "utf8",
|
|
},
|
|
);
|
|
|
|
expect(JSON.parse(stdout)).toEqual([]);
|
|
});
|
|
});
|