From 63abd1fad5f0386b4e0fb543e12f0401fad43df1 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 10:52:37 +0100 Subject: [PATCH] test: tighten plugin npm package assertions --- test/plugin-npm-package-manifest.test.ts | 27 +++++++++++++++++++++-- test/plugin-npm-runtime-build.test.ts | 28 ++++++++++++------------ 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/test/plugin-npm-package-manifest.test.ts b/test/plugin-npm-package-manifest.test.ts index dd8859c3d71..0dc6a4bb880 100644 --- a/test/plugin-npm-package-manifest.test.ts +++ b/test/plugin-npm-package-manifest.test.ts @@ -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", }, diff --git a/test/plugin-npm-runtime-build.test.ts b/test/plugin-npm-runtime-build.test.ts index 637a18abe40..37b286201cf 100644 --- a/test/plugin-npm-runtime-build.test.ts +++ b/test/plugin-npm-runtime-build.test.ts @@ -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({ - index: path.join(repoRoot, "extensions", "qqbot", "index.ts"), - "runtime-api": path.join(repoRoot, "extensions", "qqbot", "runtime-api.ts"), - "setup-entry": path.join(repoRoot, "extensions", "qqbot", "setup-entry.ts"), - }), - ); + 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({ - 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.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",