Files
openclaw/test/scripts/check-plugin-sdk-wildcard-reexports.test.ts
2026-04-27 14:52:21 +01:00

32 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { findPluginSdkWildcardReexports } from "../../scripts/check-plugin-sdk-wildcard-reexports.mjs";
describe("check-plugin-sdk-wildcard-reexports", () => {
it("flags wildcard re-exports from plugin-sdk subpaths", () => {
expect(
findPluginSdkWildcardReexports(
[
'export * from "openclaw/plugin-sdk/foo";',
'export type * from "openclaw/plugin-sdk/bar";',
'export { named } from "openclaw/plugin-sdk/foo";',
].join("\n"),
),
).toEqual([
{ line: 1, text: 'export * from "openclaw/plugin-sdk/foo";' },
{ line: 2, text: 'export type * from "openclaw/plugin-sdk/bar";' },
]);
});
it("allows explicit SDK exports and local wildcard barrels", () => {
expect(
findPluginSdkWildcardReexports(
[
'export { named } from "openclaw/plugin-sdk/foo";',
'export type { Named } from "openclaw/plugin-sdk/foo";',
'export * from "./src/runtime-api.js";',
].join("\n"),
),
).toEqual([]);
});
});