From dd27ad41a965fc559bf80eb1966f42bd34613573 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 10 May 2026 00:28:15 +0100 Subject: [PATCH] test: tighten small command assertions --- src/commands/agents.providers.test.ts | 15 +++++++-------- src/commands/dashboard.links.test.ts | 5 ++--- src/commands/models/shared.test.ts | 10 ++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/commands/agents.providers.test.ts b/src/commands/agents.providers.test.ts index ad5e7da830e..ae6953d255c 100644 --- a/src/commands/agents.providers.test.ts +++ b/src/commands/agents.providers.test.ts @@ -70,14 +70,13 @@ describe("buildProviderStatusIndex", () => { ); expect(resolveAccount).not.toHaveBeenCalled(); expect(inspectAccount).toHaveBeenCalledWith({}, "work"); - expect(map.get("workchat:work")).toMatchObject({ - provider: "workchat", - accountId: "work", - state: "linked", - configured: true, - enabled: true, - name: "Work", - }); + const status = map.get("workchat:work"); + expect(status?.provider).toBe("workchat"); + expect(status?.accountId).toBe("work"); + expect(status?.state).toBe("linked"); + expect(status?.configured).toBe(true); + expect(status?.enabled).toBe(true); + expect(status?.name).toBe("Work"); }); it("records accounts that throw during read-only resolution as not configured", async () => { diff --git a/src/commands/dashboard.links.test.ts b/src/commands/dashboard.links.test.ts index 287430fa6e4..d7f60d485cb 100644 --- a/src/commands/dashboard.links.test.ts +++ b/src/commands/dashboard.links.test.ts @@ -154,9 +154,8 @@ describe("dashboardCommand", () => { // hint string is written to runtime.log, which flows into the same // console-captured log file readable by operator.read-scoped devices. expect(formatControlUiSshHintMock).toHaveBeenCalledWith({ port: 18789, basePath: undefined }); - expect(formatControlUiSshHintMock).not.toHaveBeenCalledWith( - expect.objectContaining({ token: expect.anything() }), - ); + const [sshHintOptions] = formatControlUiSshHintMock.mock.calls[0] ?? []; + expect(sshHintOptions).not.toHaveProperty("token"); // Double-check: no logged line contains the secret. for (const call of runtime.log.mock.calls) { diff --git a/src/commands/models/shared.test.ts b/src/commands/models/shared.test.ts index 09ea65a1aef..d32906b5d38 100644 --- a/src/commands/models/shared.test.ts +++ b/src/commands/models/shared.test.ts @@ -56,11 +56,9 @@ describe("models/shared", () => { update: { channel: "beta" }, })); - expect(mocks.replaceConfigFile).toHaveBeenCalledWith({ - nextConfig: expect.objectContaining({ - update: { channel: "beta" }, - }), - baseHash: "config-1", - }); + expect(mocks.replaceConfigFile).toHaveBeenCalledOnce(); + const [replaceParams] = mocks.replaceConfigFile.mock.calls[0] ?? []; + expect(replaceParams?.nextConfig.update).toEqual({ channel: "beta" }); + expect(replaceParams?.baseHash).toBe("config-1"); }); });