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,
});
expect(resolved.changed).toBe(true);
expect(resolved.manifest).toMatchObject({
expect(resolved.manifest).toEqual({
id: "twitch",
channels: ["twitch"],
configSchema: {
type: "object",
additionalProperties: false,
properties: {},
},
channelConfigs: {
twitch: {
description: "Twitch chat integration",
label: "Twitch",
schema: {
type: "object",
required: ["channelName"],
properties: {
channelName: { type: "string" },
},
},
},
},
@@ -128,7 +140,10 @@ describe("plugin npm package manifest staging", () => {
packageDir,
});
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/**"],
peerDependencies: {
openclaw: ">=2026.4.30",
@@ -139,6 +154,14 @@ describe("plugin npm package manifest staging", () => {
},
},
openclaw: {
extensions: ["./index.ts"],
setupEntry: "./setup-entry.ts",
compat: {
pluginApi: ">=2026.4.30",
},
release: {
publishToNpm: true,
},
runtimeExtensions: ["./dist/index.js"],
runtimeSetupEntry: "./dist/setup-entry.js",
},

View File

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