

























@@ -2241,11 +2241,7 @@ describe("updateNpmInstalledPlugins", () => {
22412241dryRun: true,
22422242});
224322432244-expect(installPluginFromClawHubMock).toHaveBeenCalledWith(
2245-expect.objectContaining({
2246-spec: "clawhub:demo@rc",
2247-}),
2248-);
2244+expect(clawHubInstallCall()?.spec).toBe("clawhub:demo@rc");
22492245});
2250224622512247it("skips ClawHub plugin update when bundled version is newer", async () => {
@@ -2285,7 +2281,8 @@ describe("updateNpmInstalledPlugins", () => {
22852281expect(result.outcomes[0]?.pluginId).toBe("whatsapp");
22862282expect(result.outcomes[0]?.status).toBe("skipped");
22872283expect(result.outcomes[0]?.message).toContain("bundled version 2026.4.20 is newer");
2288-expect(warnMessages).toEqual([expect.stringContaining("bundled version 2026.4.20 is newer")]);
2284+expect(warnMessages).toHaveLength(1);
2285+expect(warnMessages[0]).toContain("bundled version 2026.4.20 is newer");
22892286});
2290228722912288it("proceeds with ClawHub plugin update when bundled version is older", async () => {
@@ -2375,7 +2372,7 @@ describe("updateNpmInstalledPlugins", () => {
2375237223762373expect(installPluginFromClawHubMock).toHaveBeenCalled();
23772374expect(result.changed).toBe(true);
2378-expect(result.outcomes[0]).toMatchObject({
2375+expectRecordFields(result.outcomes[0], {
23792376pluginId: "demo",
23802377status: "updated",
23812378currentVersion: undefined,
@@ -2861,23 +2858,15 @@ describe("syncPluginsForUpdateChannel", () => {
28612858},
28622859});
286328602864-expect(installPluginFromNpmSpecMock).toHaveBeenCalledWith(
2865-expect.objectContaining({
2866-spec: "@openclaw/legacy-chat",
2867-mode: "update",
2868-expectedPluginId: "legacy-chat",
2869-}),
2870-);
2871-expect(installPluginFromNpmSpecMock).not.toHaveBeenCalledWith(
2872-expect.objectContaining({
2873-trustedSourceLinkedOfficialInstall: true,
2874-}),
2875-);
2861+expect(npmInstallCall()?.spec).toBe("@openclaw/legacy-chat");
2862+expect(npmInstallCall()?.mode).toBe("update");
2863+expect(npmInstallCall()?.expectedPluginId).toBe("legacy-chat");
2864+expect(npmInstallCall()?.trustedSourceLinkedOfficialInstall).not.toBe(true);
28762865expect(result.changed).toBe(true);
28772866expect(result.summary.switchedToNpm).toEqual(["legacy-chat"]);
28782867expect(result.summary.errors).toStrictEqual([]);
28792868expect(result.config.plugins?.load?.paths).toStrictEqual([]);
2880-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
2869+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
28812870source: "npm",
28822871spec: "@openclaw/legacy-chat",
28832872installPath: "/tmp/openclaw-plugins/legacy-chat",
@@ -2926,13 +2915,9 @@ describe("syncPluginsForUpdateChannel", () => {
29262915},
29272916});
292829172929-expect(installPluginFromNpmSpecMock).toHaveBeenCalledWith(
2930-expect.objectContaining({
2931-spec: "@openclaw/voice-call",
2932-expectedPluginId: "voice-call",
2933-trustedSourceLinkedOfficialInstall: true,
2934-}),
2935-);
2918+expect(npmInstallCall()?.spec).toBe("@openclaw/voice-call");
2919+expect(npmInstallCall()?.expectedPluginId).toBe("voice-call");
2920+expect(npmInstallCall()?.trustedSourceLinkedOfficialInstall).toBe(true);
29362921});
2937292229382923it("installs a ClawHub-preferred externalized bundled plugin", async () => {
@@ -2977,21 +2962,17 @@ describe("syncPluginsForUpdateChannel", () => {
29772962},
29782963});
297929642980-expect(installPluginFromClawHubMock).toHaveBeenCalledWith(
2981-expect.objectContaining({
2982-spec: "clawhub:legacy-chat@2026.5.1-beta.2",
2983-baseUrl: "https://clawhub.ai",
2984-mode: "update",
2985-expectedPluginId: "legacy-chat",
2986-}),
2987-);
2965+expect(clawHubInstallCall()?.spec).toBe("clawhub:legacy-chat@2026.5.1-beta.2");
2966+expect(clawHubInstallCall()?.baseUrl).toBe("https://clawhub.ai");
2967+expect(clawHubInstallCall()?.mode).toBe("update");
2968+expect(clawHubInstallCall()?.expectedPluginId).toBe("legacy-chat");
29882969expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
29892970expect(result.changed).toBe(true);
29902971expect(result.summary.switchedToClawHub).toEqual(["legacy-chat"]);
29912972expect(result.summary.switchedToNpm).toStrictEqual([]);
29922973expect(result.summary.errors).toStrictEqual([]);
29932974expect(result.config.plugins?.load?.paths).toStrictEqual([]);
2994-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
2975+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
29952976source: "clawhub",
29962977spec: "clawhub:legacy-chat@2026.5.1-beta.2",
29972978installPath: "/tmp/openclaw-plugins/legacy-chat",
@@ -3058,26 +3039,18 @@ describe("syncPluginsForUpdateChannel", () => {
30583039},
30593040});
306030413061-expect(installPluginFromNpmSpecMock).toHaveBeenCalledWith(
3062-expect.objectContaining({
3063-spec: "@openclaw/legacy-chat",
3064-mode: "update",
3065-expectedPluginId: "legacy-chat",
3066-}),
3067-);
3068-expect(installPluginFromNpmSpecMock).not.toHaveBeenCalledWith(
3069-expect.objectContaining({
3070-trustedSourceLinkedOfficialInstall: true,
3071-}),
3072-);
3042+expect(npmInstallCall()?.spec).toBe("@openclaw/legacy-chat");
3043+expect(npmInstallCall()?.mode).toBe("update");
3044+expect(npmInstallCall()?.expectedPluginId).toBe("legacy-chat");
3045+expect(npmInstallCall()?.trustedSourceLinkedOfficialInstall).not.toBe(true);
30733046expect(result.changed).toBe(true);
30743047expect(result.summary.switchedToClawHub).toStrictEqual([]);
30753048expect(result.summary.switchedToNpm).toEqual(["legacy-chat"]);
30763049expect(result.summary.warnings).toEqual([
30773050"ClawHub clawhub:legacy-chat@2026.5.1-beta.2 unavailable for legacy-chat; falling back to npm @openclaw/legacy-chat.",
30783051]);
30793052expect(result.summary.errors).toStrictEqual([]);
3080-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3053+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
30813054source: "npm",
30823055spec: "@openclaw/legacy-chat",
30833056installPath: "/tmp/openclaw-plugins/legacy-chat",
@@ -3130,13 +3103,9 @@ describe("syncPluginsForUpdateChannel", () => {
31303103},
31313104});
313231053133-expect(installPluginFromNpmSpecMock).toHaveBeenCalledWith(
3134-expect.objectContaining({
3135-spec: "@openclaw/voice-call",
3136-expectedPluginId: "voice-call",
3137-trustedSourceLinkedOfficialInstall: true,
3138-}),
3139-);
3106+expect(npmInstallCall()?.spec).toBe("@openclaw/voice-call");
3107+expect(npmInstallCall()?.expectedPluginId).toBe("voice-call");
3108+expect(npmInstallCall()?.trustedSourceLinkedOfficialInstall).toBe(true);
31403109});
3141311031423111it("moves ClawHub-preferred externalized plugin fallbacks back to ClawHub", async () => {
@@ -3179,17 +3148,13 @@ describe("syncPluginsForUpdateChannel", () => {
31793148},
31803149});
318131503182-expect(installPluginFromClawHubMock).toHaveBeenCalledWith(
3183-expect.objectContaining({
3184-spec: "clawhub:legacy-chat@2026.5.1-beta.2",
3185-mode: "update",
3186-expectedPluginId: "legacy-chat",
3187-}),
3188-);
3151+expect(clawHubInstallCall()?.spec).toBe("clawhub:legacy-chat@2026.5.1-beta.2");
3152+expect(clawHubInstallCall()?.mode).toBe("update");
3153+expect(clawHubInstallCall()?.expectedPluginId).toBe("legacy-chat");
31893154expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
31903155expect(result.changed).toBe(true);
31913156expect(result.summary.switchedToClawHub).toEqual(["legacy-chat"]);
3192-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3157+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
31933158source: "clawhub",
31943159spec: "clawhub:legacy-chat@2026.5.1-beta.2",
31953160installPath: "/tmp/openclaw-plugins/legacy-chat",
@@ -3266,16 +3231,12 @@ describe("syncPluginsForUpdateChannel", () => {
32663231config: {},
32673232});
326832333269-expect(installPluginFromNpmSpecMock).toHaveBeenCalledWith(
3270-expect.objectContaining({
3271-spec: "@openclaw/default-chat",
3272-mode: "update",
3273-expectedPluginId: "default-chat",
3274-}),
3275-);
3234+expect(npmInstallCall()?.spec).toBe("@openclaw/default-chat");
3235+expect(npmInstallCall()?.mode).toBe("update");
3236+expect(npmInstallCall()?.expectedPluginId).toBe("default-chat");
32763237expect(result.changed).toBe(true);
32773238expect(result.summary.switchedToNpm).toEqual(["default-chat"]);
3278-expect(result.config.plugins?.installs?.["default-chat"]).toMatchObject({
3239+expectRecordFields(result.config.plugins?.installs?.["default-chat"], {
32793240source: "npm",
32803241spec: "@openclaw/default-chat",
32813242installPath: "/tmp/openclaw-plugins/default-chat",
@@ -3316,7 +3277,7 @@ describe("syncPluginsForUpdateChannel", () => {
3316327733173278expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
33183279expect(result.changed).toBe(false);
3319-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3280+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
33203281source: "path",
33213282});
33223283});
@@ -3395,7 +3356,7 @@ describe("syncPluginsForUpdateChannel", () => {
3395335633963357expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
33973358expect(result.changed).toBe(false);
3398-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3359+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
33993360source: "path",
34003361sourcePath: "/workspace/plugins/legacy-chat",
34013362});
@@ -3439,7 +3400,7 @@ describe("syncPluginsForUpdateChannel", () => {
3439340034403401expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
34413402expect(result.changed).toBe(false);
3442-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3403+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
34433404source: "path",
34443405});
34453406});
@@ -3480,7 +3441,7 @@ describe("syncPluginsForUpdateChannel", () => {
34803441expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
34813442expect(result.changed).toBe(true);
34823443expect(result.config.plugins?.load?.paths).toEqual(["/workspace/plugins/other"]);
3483-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3444+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
34843445source: "npm",
34853446spec: "@openclaw/legacy-chat",
34863447});
@@ -3522,7 +3483,7 @@ describe("syncPluginsForUpdateChannel", () => {
35223483expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
35233484expect(result.changed).toBe(true);
35243485expect(result.config.plugins?.load?.paths).toEqual(["/workspace/plugins/other"]);
3525-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3486+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
35263487source: "npm",
35273488resolvedName: "@openclaw/legacy-chat",
35283489});
@@ -3565,7 +3526,7 @@ describe("syncPluginsForUpdateChannel", () => {
35653526expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
35663527expect(result.changed).toBe(true);
35673528expect(result.config.plugins?.load?.paths).toEqual(["/workspace/plugins/other"]);
3568-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3529+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
35693530source: "npm",
35703531spec: "@openclaw/legacy-chat@1.2.3",
35713532});
@@ -3611,7 +3572,7 @@ describe("syncPluginsForUpdateChannel", () => {
36113572expect(installPluginFromNpmSpecMock).not.toHaveBeenCalled();
36123573expect(result.changed).toBe(true);
36133574expect(result.config.plugins?.load?.paths).toEqual(["/workspace/plugins/other"]);
3614-expect(result.config.plugins?.installs?.["legacy-chat"]).toMatchObject({
3575+expectRecordFields(result.config.plugins?.installs?.["legacy-chat"], {
36153576source: "clawhub",
36163577spec: "clawhub:legacy-chat@2026.5.1",
36173578});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。