






















@@ -7,6 +7,47 @@ const mocks = vi.hoisted(() => ({
77resolveProviderInstallCatalogEntries: vi.fn(),
88}));
9910+type AutoEnableDetectionCall = {
11+config: {
12+agents?: {
13+defaults?: {
14+model?: string;
15+agentRuntime?: { id?: string };
16+};
17+};
18+};
19+};
20+21+type MissingPluginInstallRepairCall = {
22+pluginIds: string[];
23+channelIds?: string[];
24+env?: NodeJS.ProcessEnv;
25+};
26+27+function readOnlyAutoEnableDetectionCall(): AutoEnableDetectionCall {
28+expect(mocks.detectPluginAutoEnableCandidates).toHaveBeenCalledOnce();
29+const calls = mocks.detectPluginAutoEnableCandidates.mock.calls as unknown as Array<
30+[AutoEnableDetectionCall]
31+>;
32+const call = calls[0]?.[0];
33+if (!call) {
34+throw new Error("Expected auto-enable detection call");
35+}
36+return call;
37+}
38+39+function readOnlyMissingPluginInstallRepairCall(): MissingPluginInstallRepairCall {
40+expect(mocks.repairMissingPluginInstallsForIds).toHaveBeenCalledOnce();
41+const calls = mocks.repairMissingPluginInstallsForIds.mock.calls as unknown as Array<
42+[MissingPluginInstallRepairCall]
43+>;
44+const call = calls[0]?.[0];
45+if (!call) {
46+throw new Error("Expected missing plugin install repair call");
47+}
48+return call;
49+}
50+1051vi.mock("../../../config/plugin-auto-enable.js", () => ({
1152detectPluginAutoEnableCandidates: mocks.detectPluginAutoEnableCandidates,
1253}));
@@ -154,18 +195,9 @@ describe("configured plugin install release step", () => {
154195env: {},
155196});
156197157-expect(mocks.detectPluginAutoEnableCandidates).toHaveBeenCalledWith(
158-expect.objectContaining({
159-config: expect.objectContaining({
160-agents: expect.objectContaining({
161-defaults: expect.objectContaining({
162-model: "openai/gpt-5.4",
163-agentRuntime: { id: "codex" },
164-}),
165-}),
166-}),
167-}),
168-);
198+const detectionCall = readOnlyAutoEnableDetectionCall();
199+expect(detectionCall.config.agents?.defaults?.model).toBe("openai/gpt-5.4");
200+expect(detectionCall.config.agents?.defaults?.agentRuntime).toEqual({ id: "codex" });
169201expect(result.pluginIds).toEqual(["codex"]);
170202expect(result.channelIds).toStrictEqual([]);
171203});
@@ -270,13 +302,10 @@ describe("configured plugin install release step", () => {
270302env: {},
271303});
272304273-expect(mocks.repairMissingPluginInstallsForIds).toHaveBeenCalledWith(
274-expect.objectContaining({
275-pluginIds: ["codex"],
276-channelIds: [],
277-env: {},
278-}),
279-);
305+const repairCall = readOnlyMissingPluginInstallRepairCall();
306+expect(repairCall.pluginIds).toEqual(["codex"]);
307+expect(repairCall.channelIds).toEqual([]);
308+expect(repairCall.env).toEqual({});
280309expect(result.touchedConfig).toBe(true);
281310expect(result.completed).toBe(true);
282311});
@@ -305,12 +334,9 @@ describe("configured plugin install release step", () => {
305334env: { OPENCLAW_UPDATE_IN_PROGRESS: "1" },
306335});
307336308-expect(mocks.repairMissingPluginInstallsForIds).toHaveBeenCalledWith(
309-expect.objectContaining({
310-pluginIds: ["codex"],
311-env: { OPENCLAW_UPDATE_IN_PROGRESS: "1" },
312-}),
313-);
337+const repairCall = readOnlyMissingPluginInstallRepairCall();
338+expect(repairCall.pluginIds).toEqual(["codex"]);
339+expect(repairCall.env).toEqual({ OPENCLAW_UPDATE_IN_PROGRESS: "1" });
314340expect(result).toEqual({
315341changes: [
316342'Skipped package-manager repair for configured plugin "codex" during package update; rerun "openclaw doctor --fix" after the update completes.',
@@ -342,13 +368,10 @@ describe("configured plugin install release step", () => {
342368env: {},
343369});
344370345-expect(mocks.repairMissingPluginInstallsForIds).toHaveBeenCalledWith(
346-expect.objectContaining({
347-pluginIds: ["discord"],
348-channelIds: [],
349-env: {},
350-}),
351-);
371+const repairCall = readOnlyMissingPluginInstallRepairCall();
372+expect(repairCall.pluginIds).toEqual(["discord"]);
373+expect(repairCall.channelIds).toEqual([]);
374+expect(repairCall.env).toEqual({});
352375expect(result).toEqual({
353376changes: ['Installed missing configured plugin "discord".'],
354377warnings: [],
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。