test: tighten plugin npm package assertions

This commit is contained in:
Peter Steinberger
2026-05-09 10:52:37 +01:00
parent eb9c227a09
commit 63abd1fad5
2 changed files with 39 additions and 16 deletions

View File

@@ -96,12 +96,24 @@ describe("plugin npm package manifest staging", () => {
packageDir, packageDir,
}); });
expect(resolved.changed).toBe(true); expect(resolved.changed).toBe(true);
expect(resolved.manifest).toMatchObject({ expect(resolved.manifest).toEqual({
id: "twitch",
channels: ["twitch"],
configSchema: {
type: "object",
additionalProperties: false,
properties: {},
},
channelConfigs: { channelConfigs: {
twitch: { twitch: {
description: "Twitch chat integration",
label: "Twitch", label: "Twitch",
schema: { schema: {
type: "object",
required: ["channelName"], required: ["channelName"],
properties: {
channelName: { type: "string" },
},
}, },
}, },
}, },
@@ -128,7 +140,10 @@ describe("plugin npm package manifest staging", () => {
packageDir, packageDir,
}); });
expect(resolved.changed).toBe(true); expect(resolved.changed).toBe(true);
expect(resolved.packageJson).toMatchObject({ expect(resolved.packageJson).toEqual({
name: "@openclaw/diffs",
version: "2026.5.3",
type: "module",
files: ["dist/**", "openclaw.plugin.json", "README.md", "SKILL.md", "skills/**"], files: ["dist/**", "openclaw.plugin.json", "README.md", "SKILL.md", "skills/**"],
peerDependencies: { peerDependencies: {
openclaw: ">=2026.4.30", openclaw: ">=2026.4.30",
@@ -139,6 +154,14 @@ describe("plugin npm package manifest staging", () => {
}, },
}, },
openclaw: { openclaw: {
extensions: ["./index.ts"],
setupEntry: "./setup-entry.ts",
compat: {
pluginApi: ">=2026.4.30",
},
release: {
publishToNpm: true,
},
runtimeExtensions: ["./dist/index.js"], runtimeExtensions: ["./dist/index.js"],
runtimeSetupEntry: "./dist/setup-entry.js", runtimeSetupEntry: "./dist/setup-entry.js",
}, },

View File

@@ -55,13 +55,15 @@ describe("plugin npm runtime build planning", () => {
packageDir: path.join(repoRoot, "extensions", "qqbot"), packageDir: path.join(repoRoot, "extensions", "qqbot"),
}); });
const qqbotRuntimePlan = expectPluginNpmRuntimeBuildPlan(qqbotPlan); const qqbotRuntimePlan = expectPluginNpmRuntimeBuildPlan(qqbotPlan);
expect(qqbotRuntimePlan.entry).toEqual( expect(qqbotRuntimePlan.entry).toEqual({
expect.objectContaining({ api: path.join(repoRoot, "extensions", "qqbot", "api.ts"),
index: path.join(repoRoot, "extensions", "qqbot", "index.ts"), "channel-plugin-api": path.join(repoRoot, "extensions", "qqbot", "channel-plugin-api.ts"),
"runtime-api": path.join(repoRoot, "extensions", "qqbot", "runtime-api.ts"), index: path.join(repoRoot, "extensions", "qqbot", "index.ts"),
"setup-entry": path.join(repoRoot, "extensions", "qqbot", "setup-entry.ts"), "runtime-api": path.join(repoRoot, "extensions", "qqbot", "runtime-api.ts"),
}), "secret-contract-api": path.join(repoRoot, "extensions", "qqbot", "secret-contract-api.ts"),
); "setup-entry": path.join(repoRoot, "extensions", "qqbot", "setup-entry.ts"),
"setup-plugin-api": path.join(repoRoot, "extensions", "qqbot", "setup-plugin-api.ts"),
});
expect(qqbotRuntimePlan.runtimeExtensions).toEqual(["./dist/index.js"]); expect(qqbotRuntimePlan.runtimeExtensions).toEqual(["./dist/index.js"]);
expect(qqbotRuntimePlan.runtimeSetupEntry).toBe("./dist/setup-entry.js"); expect(qqbotRuntimePlan.runtimeSetupEntry).toBe("./dist/setup-entry.js");
@@ -70,13 +72,11 @@ describe("plugin npm runtime build planning", () => {
packageDir: path.join(repoRoot, "extensions", "diffs"), packageDir: path.join(repoRoot, "extensions", "diffs"),
}); });
const diffsRuntimePlan = expectPluginNpmRuntimeBuildPlan(diffsPlan); const diffsRuntimePlan = expectPluginNpmRuntimeBuildPlan(diffsPlan);
expect(diffsRuntimePlan.entry).toEqual( expect(diffsRuntimePlan.entry).toEqual({
expect.objectContaining({ api: path.join(repoRoot, "extensions", "diffs", "api.ts"),
api: path.join(repoRoot, "extensions", "diffs", "api.ts"), index: path.join(repoRoot, "extensions", "diffs", "index.ts"),
index: path.join(repoRoot, "extensions", "diffs", "index.ts"), "runtime-api": path.join(repoRoot, "extensions", "diffs", "runtime-api.ts"),
"runtime-api": path.join(repoRoot, "extensions", "diffs", "runtime-api.ts"), });
}),
);
expect(diffsRuntimePlan.packageFiles).toEqual([ expect(diffsRuntimePlan.packageFiles).toEqual([
"dist/**", "dist/**",
"openclaw.plugin.json", "openclaw.plugin.json",