mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 20:21:13 +00:00
fix(plugins): keep test helpers out of contract barrels (#63311)
Merged via squash.
Prepared head SHA: 769e90c6af
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
32
src/plugins/public-surface-runtime.test.ts
Normal file
32
src/plugins/public-surface-runtime.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizeBundledPluginArtifactSubpath } from "./public-surface-runtime.js";
|
||||
|
||||
describe("bundled plugin public surface runtime", () => {
|
||||
it("allows plugin-local nested artifact paths", () => {
|
||||
expect(normalizeBundledPluginArtifactSubpath("src/outbound-adapter.js")).toBe(
|
||||
"src/outbound-adapter.js",
|
||||
);
|
||||
expect(normalizeBundledPluginArtifactSubpath("./test-api.js")).toBe("test-api.js");
|
||||
});
|
||||
|
||||
it("rejects artifact paths that escape the plugin root", () => {
|
||||
expect(() => normalizeBundledPluginArtifactSubpath("../outside.js")).toThrow(
|
||||
/must stay plugin-local/,
|
||||
);
|
||||
expect(() => normalizeBundledPluginArtifactSubpath("src/../outside.js")).toThrow(
|
||||
/must stay plugin-local/,
|
||||
);
|
||||
expect(() => normalizeBundledPluginArtifactSubpath("/tmp/outside.js")).toThrow(
|
||||
/must stay plugin-local/,
|
||||
);
|
||||
expect(() => normalizeBundledPluginArtifactSubpath("..\\outside.js")).toThrow(
|
||||
/must stay plugin-local/,
|
||||
);
|
||||
expect(() => normalizeBundledPluginArtifactSubpath("C:outside.js")).toThrow(
|
||||
/must stay plugin-local/,
|
||||
);
|
||||
expect(() => normalizeBundledPluginArtifactSubpath("src/C:outside.js")).toThrow(
|
||||
/must stay plugin-local/,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user