























@@ -1648,13 +1648,9 @@ describe("updateNpmInstalledPlugins", () => {
16481648dryRun: true,
16491649});
165016501651-expect(installPluginFromNpmSpecMock).toHaveBeenCalledWith(
1652-expect.objectContaining({
1653-spec: "@acme/demo",
1654-expectedPluginId: "demo",
1655-dryRun: true,
1656-}),
1657-);
1651+expect(npmInstallCall()?.spec).toBe("@acme/demo");
1652+expect(npmInstallCall()?.expectedPluginId).toBe("demo");
1653+expect(npmInstallCall()?.dryRun).toBe(true);
16581654expect(result.changed).toBe(false);
16591655expect(result.config).toBe(config);
16601656expect(result.outcomes).toEqual([
@@ -1697,12 +1693,8 @@ describe("updateNpmInstalledPlugins", () => {
16971693logger: { warn },
16981694});
169916951700-expect(installPluginFromNpmSpecMock).toHaveBeenCalledWith(
1701-expect.objectContaining({
1702-spec: "@acme/demo",
1703-expectedPluginId: "demo",
1704-}),
1705-);
1696+expect(npmInstallCall()?.spec).toBe("@acme/demo");
1697+expect(npmInstallCall()?.expectedPluginId).toBe("demo");
17061698const message =
17071699'Disabled "demo" after plugin update failure; OpenClaw will continue without it. Failed to update demo: registry timeout';
17081700expect(warn).toHaveBeenCalledWith(message);
@@ -1961,18 +1953,8 @@ describe("updateNpmInstalledPlugins", () => {
19611953logger: { warn: (msg) => warnMessages.push(msg) },
19621954});
196319551964-expect(installPluginFromNpmSpecMock).toHaveBeenNthCalledWith(
1965-1,
1966-expect.objectContaining({
1967-spec: "openclaw-codex-app-server@beta",
1968-}),
1969-);
1970-expect(installPluginFromNpmSpecMock).toHaveBeenNthCalledWith(
1971-2,
1972-expect.objectContaining({
1973-spec: "openclaw-codex-app-server",
1974-}),
1975-);
1956+expect(npmInstallCall(0)?.spec).toBe("openclaw-codex-app-server@beta");
1957+expect(npmInstallCall(1)?.spec).toBe("openclaw-codex-app-server");
19761958expect(warnMessages).toEqual([expect.stringContaining("has no beta npm release")]);
19771959expectCodexAppServerInstallState({
19781960 result,
@@ -2011,18 +1993,8 @@ describe("updateNpmInstalledPlugins", () => {
20111993logger: { warn: (msg) => warnMessages.push(msg) },
20121994});
201319952014-expect(installPluginFromNpmSpecMock).toHaveBeenNthCalledWith(
2015-1,
2016-expect.objectContaining({
2017-spec: "openclaw-codex-app-server@beta",
2018-}),
2019-);
2020-expect(installPluginFromNpmSpecMock).toHaveBeenNthCalledWith(
2021-2,
2022-expect.objectContaining({
2023-spec: "openclaw-codex-app-server",
2024-}),
2025-);
1996+expect(npmInstallCall(0)?.spec).toBe("openclaw-codex-app-server@beta");
1997+expect(npmInstallCall(1)?.spec).toBe("openclaw-codex-app-server");
20261998expect(warnMessages).toEqual([expect.stringContaining("failed beta npm update")]);
20271999expectCodexAppServerInstallState({
20282000 result,
@@ -2126,16 +2098,12 @@ describe("updateNpmInstalledPlugins", () => {
21262098timeoutMs: 1_800_000,
21272099});
212821002129-expect(installPluginFromClawHubMock).toHaveBeenCalledWith(
2130-expect.objectContaining({
2131-spec: "clawhub:demo",
2132-baseUrl: "https://clawhub.ai",
2133-expectedPluginId: "demo",
2134-mode: "update",
2135-timeoutMs: 1_800_000,
2136-}),
2137-);
2138-expect(result.config.plugins?.installs?.demo).toMatchObject({
2101+expect(clawHubInstallCall()?.spec).toBe("clawhub:demo");
2102+expect(clawHubInstallCall()?.baseUrl).toBe("https://clawhub.ai");
2103+expect(clawHubInstallCall()?.expectedPluginId).toBe("demo");
2104+expect(clawHubInstallCall()?.mode).toBe("update");
2105+expect(clawHubInstallCall()?.timeoutMs).toBe(1_800_000);
2106+expectRecordFields(result.config.plugins?.installs?.demo, {
21392107source: "clawhub",
21402108spec: "clawhub:demo",
21412109installPath: "/tmp/demo",
@@ -2179,14 +2147,10 @@ describe("updateNpmInstalledPlugins", () => {
21792147updateChannel: "beta",
21802148});
218121492182-expect(installPluginFromClawHubMock).toHaveBeenCalledWith(
2183-expect.objectContaining({
2184-spec: "clawhub:demo@beta",
2185-baseUrl: "https://clawhub.ai",
2186-expectedPluginId: "demo",
2187-}),
2188-);
2189-expect(result.config.plugins?.installs?.demo).toMatchObject({
2150+expect(clawHubInstallCall()?.spec).toBe("clawhub:demo@beta");
2151+expect(clawHubInstallCall()?.baseUrl).toBe("https://clawhub.ai");
2152+expect(clawHubInstallCall()?.expectedPluginId).toBe("demo");
2153+expectRecordFields(result.config.plugins?.installs?.demo, {
21902154source: "clawhub",
21912155spec: "clawhub:demo",
21922156installPath: "/tmp/demo",
@@ -2226,20 +2190,10 @@ describe("updateNpmInstalledPlugins", () => {
22262190logger: { warn: (msg) => warnMessages.push(msg) },
22272191});
222821922229-expect(installPluginFromClawHubMock).toHaveBeenNthCalledWith(
2230-1,
2231-expect.objectContaining({
2232-spec: "clawhub:demo@beta",
2233-}),
2234-);
2235-expect(installPluginFromClawHubMock).toHaveBeenNthCalledWith(
2236-2,
2237-expect.objectContaining({
2238-spec: "clawhub:demo",
2239-}),
2240-);
2193+expect(clawHubInstallCall(0)?.spec).toBe("clawhub:demo@beta");
2194+expect(clawHubInstallCall(1)?.spec).toBe("clawhub:demo");
22412195expect(warnMessages).toEqual([expect.stringContaining("has no beta ClawHub release")]);
2242-expect(result.config.plugins?.installs?.demo).toMatchObject({
2196+expectRecordFields(result.config.plugins?.installs?.demo, {
22432197source: "clawhub",
22442198spec: "clawhub:demo",
22452199installPath: "/tmp/demo",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。