test: tighten small command assertions · openclaw/openclaw@dd27ad4
steipete
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -70,14 +70,13 @@ describe("buildProviderStatusIndex", () => {
|
70 | 70 | ); |
71 | 71 | expect(resolveAccount).not.toHaveBeenCalled(); |
72 | 72 | expect(inspectAccount).toHaveBeenCalledWith({}, "work"); |
73 | | -expect(map.get("workchat:work")).toMatchObject({ |
74 | | -provider: "workchat", |
75 | | -accountId: "work", |
76 | | -state: "linked", |
77 | | -configured: true, |
78 | | -enabled: true, |
79 | | -name: "Work", |
80 | | -}); |
| 73 | +const status = map.get("workchat:work"); |
| 74 | +expect(status?.provider).toBe("workchat"); |
| 75 | +expect(status?.accountId).toBe("work"); |
| 76 | +expect(status?.state).toBe("linked"); |
| 77 | +expect(status?.configured).toBe(true); |
| 78 | +expect(status?.enabled).toBe(true); |
| 79 | +expect(status?.name).toBe("Work"); |
81 | 80 | }); |
82 | 81 | |
83 | 82 | it("records accounts that throw during read-only resolution as not configured", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -154,9 +154,8 @@ describe("dashboardCommand", () => {
|
154 | 154 | // hint string is written to runtime.log, which flows into the same |
155 | 155 | // console-captured log file readable by operator.read-scoped devices. |
156 | 156 | expect(formatControlUiSshHintMock).toHaveBeenCalledWith({ port: 18789, basePath: undefined }); |
157 | | -expect(formatControlUiSshHintMock).not.toHaveBeenCalledWith( |
158 | | -expect.objectContaining({ token: expect.anything() }), |
159 | | -); |
| 157 | +const [sshHintOptions] = formatControlUiSshHintMock.mock.calls[0] ?? []; |
| 158 | +expect(sshHintOptions).not.toHaveProperty("token"); |
160 | 159 | |
161 | 160 | // Double-check: no logged line contains the secret. |
162 | 161 | for (const call of runtime.log.mock.calls) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -56,11 +56,9 @@ describe("models/shared", () => {
|
56 | 56 | update: { channel: "beta" }, |
57 | 57 | })); |
58 | 58 | |
59 | | -expect(mocks.replaceConfigFile).toHaveBeenCalledWith({ |
60 | | -nextConfig: expect.objectContaining({ |
61 | | -update: { channel: "beta" }, |
62 | | -}), |
63 | | -baseHash: "config-1", |
64 | | -}); |
| 59 | +expect(mocks.replaceConfigFile).toHaveBeenCalledOnce(); |
| 60 | +const [replaceParams] = mocks.replaceConfigFile.mock.calls[0] ?? []; |
| 61 | +expect(replaceParams?.nextConfig.update).toEqual({ channel: "beta" }); |
| 62 | +expect(replaceParams?.baseHash).toBe("config-1"); |
65 | 63 | }); |
66 | 64 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。