diff --git a/src/commands/doctor/shared/channel-legacy-config-migrate.test.ts b/src/commands/doctor/shared/channel-legacy-config-migrate.test.ts index 5e36651880a..1a265ad9c07 100644 --- a/src/commands/doctor/shared/channel-legacy-config-migrate.test.ts +++ b/src/commands/doctor/shared/channel-legacy-config-migrate.test.ts @@ -82,10 +82,8 @@ describe("bundled channel legacy config migrations", () => { const nextChannels = (result.next.channels ?? {}) as { slack?: Record; }; - expect(nextChannels.slack).toMatchObject({ - streaming: true, - normalizedByBundledContract: true, - }); + expect(nextChannels.slack?.streaming).toBe(true); + expect(nextChannels.slack?.normalizedByBundledContract).toBe(true); expect(result.changes).toEqual(["Normalized channels.slack via bundled doctor contract."]); }); @@ -129,10 +127,22 @@ describe("bundled channel legacy config migrations", () => { }, }); - expect(applyPluginDoctorCompatibilityMigrations).toHaveBeenCalledWith(expect.any(Object), { - config: expect.any(Object), - pluginIds: ["mattermost"], + expect(applyPluginDoctorCompatibilityMigrations).toHaveBeenCalledOnce(); + const migrationCall = applyPluginDoctorCompatibilityMigrations.mock.calls[0]; + expect(typeof migrationCall?.[0]).toBe("object"); + expect(migrationCall?.[1]?.config).toStrictEqual({ + channels: { + mattermost: { + allowPrivateNetwork: true, + accounts: { + work: { + allowPrivateNetwork: false, + }, + }, + }, + }, }); + expect(migrationCall?.[1]?.pluginIds).toStrictEqual(["mattermost"]); const nextChannels = (result.next.channels ?? {}) as { mattermost?: Record; @@ -150,11 +160,12 @@ describe("bundled channel legacy config migrations", () => { }, }, }); - expect(result.changes).toEqual( - expect.arrayContaining([ - "Moved channels.mattermost.allowPrivateNetwork → channels.mattermost.network.dangerouslyAllowPrivateNetwork (true).", - "Moved channels.mattermost.accounts.work.allowPrivateNetwork → channels.mattermost.accounts.work.network.dangerouslyAllowPrivateNetwork (false).", - ]), + expect(result.changes).toHaveLength(2); + expect(result.changes).toContain( + "Moved channels.mattermost.allowPrivateNetwork → channels.mattermost.network.dangerouslyAllowPrivateNetwork (true).", + ); + expect(result.changes).toContain( + "Moved channels.mattermost.accounts.work.allowPrivateNetwork → channels.mattermost.accounts.work.network.dangerouslyAllowPrivateNetwork (false).", ); }); @@ -189,7 +200,10 @@ describe("bundled channel legacy config migrations", () => { }; const result = applyChannelDoctorCompatibilityMigrations(config); - expect(applyPluginDoctorCompatibilityMigrations).toHaveBeenCalledWith(expect.any(Object), { + expect(applyPluginDoctorCompatibilityMigrations).toHaveBeenCalledOnce(); + const migrationCall = applyPluginDoctorCompatibilityMigrations.mock.calls[0]; + expect(typeof migrationCall?.[0]).toBe("object"); + expect(migrationCall?.[1]).toStrictEqual({ config, pluginIds: ["lossless-claw"], }); diff --git a/src/commands/doctor/shared/codex-route-warnings.test.ts b/src/commands/doctor/shared/codex-route-warnings.test.ts index b5f3b9f402c..5e2c2ac13f3 100644 --- a/src/commands/doctor/shared/codex-route-warnings.test.ts +++ b/src/commands/doctor/shared/codex-route-warnings.test.ts @@ -212,10 +212,8 @@ describe("collectCodexRouteWarnings", () => { expect(result.cfg.agents?.defaults?.models).toEqual({ "openai/gpt-5.5": { alias: "codex" }, }); - expect(result.cfg.agents?.list?.[0]).toMatchObject({ - id: "worker", - model: "openai/gpt-5.4", - }); + expect(result.cfg.agents?.list?.[0]?.id).toBe("worker"); + expect(result.cfg.agents?.list?.[0]?.model).toBe("openai/gpt-5.4"); expect(result.cfg.agents?.list?.[0]?.agentRuntime).toBeUndefined(); expect(result.cfg.channels?.modelByChannel?.telegram?.default).toBe("openai/gpt-5.4"); expect(result.cfg.hooks?.mappings?.[0]?.model).toBe("openai/gpt-5.4-mini"); @@ -276,26 +274,22 @@ describe("collectCodexRouteWarnings", () => { }); expect(result).toEqual({ changed: true, sessionKeys: ["main"] }); - expect(store.main).toMatchObject({ - updatedAt: 123, - modelProvider: "openai", - model: "gpt-5.5", - providerOverride: "openai", - modelOverride: "gpt-5.4", - modelOverrideSource: "auto", - authProfileOverride: "openai-codex:default", - authProfileOverrideSource: "auto", - authProfileOverrideCompactionCount: 2, - }); + expect(store.main.updatedAt).toBe(123); + expect(store.main.modelProvider).toBe("openai"); + expect(store.main.model).toBe("gpt-5.5"); + expect(store.main.providerOverride).toBe("openai"); + expect(store.main.modelOverride).toBe("gpt-5.4"); + expect(store.main.modelOverrideSource).toBe("auto"); + expect(store.main.authProfileOverride).toBe("openai-codex:default"); + expect(store.main.authProfileOverrideSource).toBe("auto"); + expect(store.main.authProfileOverrideCompactionCount).toBe(2); expect(store.main.agentHarnessId).toBeUndefined(); expect(store.main.agentRuntimeOverride).toBeUndefined(); expect(store.main.fallbackNoticeSelectedModel).toBeUndefined(); expect(store.main.fallbackNoticeActiveModel).toBeUndefined(); expect(store.main.fallbackNoticeReason).toBeUndefined(); - expect(store.other).toMatchObject({ - updatedAt: 2, - agentHarnessId: "codex", - }); + expect(store.other.updatedAt).toBe(2); + expect(store.other.agentHarnessId).toBe("codex"); }); it("keeps Codex session auth pins while leaving runtime unpinned", () => { @@ -316,13 +310,11 @@ describe("collectCodexRouteWarnings", () => { }); expect(result).toEqual({ changed: true, sessionKeys: ["main"] }); - expect(store.main).toMatchObject({ - updatedAt: 123, - providerOverride: "openai", - modelOverride: "gpt-5.5", - authProfileOverride: "openai-codex:default", - authProfileOverrideSource: "auto", - }); + expect(store.main.updatedAt).toBe(123); + expect(store.main.providerOverride).toBe("openai"); + expect(store.main.modelOverride).toBe("gpt-5.5"); + expect(store.main.authProfileOverride).toBe("openai-codex:default"); + expect(store.main.authProfileOverrideSource).toBe("auto"); expect(store.main.agentHarnessId).toBeUndefined(); expect(store.main.agentRuntimeOverride).toBeUndefined(); }); @@ -348,12 +340,10 @@ describe("collectCodexRouteWarnings", () => { }); expect(result).toEqual({ changed: false, sessionKeys: [] }); - expect(store.main).toMatchObject({ - updatedAt: 1, - agentHarnessId: "pi", - agentRuntimeOverride: "pi", - authProfileOverride: "openai:work", - }); + expect(store.main.updatedAt).toBe(1); + expect(store.main.agentHarnessId).toBe("pi"); + expect(store.main.agentRuntimeOverride).toBe("pi"); + expect(store.main.authProfileOverride).toBe("openai:work"); }); it("repairs legacy routes without probing OAuth readiness", () => {