test: verify command output text · openclaw/openclaw@8a8cb6f
shakkernerd
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -131,9 +131,8 @@ describe("agents bind/unbind commands", () => {
|
131 | 131 | |
132 | 132 | await agentsBindingsCommand({}, runtime); |
133 | 133 | |
134 | | -expect(runtime.log).toHaveBeenCalledWith(expect.stringContaining("main <- matrix")); |
135 | 134 | expect(runtime.log).toHaveBeenCalledWith( |
136 | | -expect.stringContaining("ops <- telegram accountId=work"), |
| 135 | +["Routing bindings:", "- main <- matrix", "- ops <- telegram accountId=work"].join("\n"), |
137 | 136 | ); |
138 | 137 | }); |
139 | 138 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -121,9 +121,21 @@ describe("agentsListCommand", () => {
|
121 | 121 | |
122 | 122 | expect(buildProviderStatusIndexMock).toHaveBeenCalledOnce(); |
123 | 123 | expect(buildProviderSummaryMetadataIndexMock).toHaveBeenCalledOnce(); |
124 | | -expect(runtime.log).toHaveBeenCalledWith(expect.stringContaining("Providers:")); |
125 | | -expect(runtime.log).toHaveBeenCalledWith( |
126 | | -expect.stringContaining("Telegram default: configured"), |
127 | | -); |
| 124 | +expect(runtime.log.mock.calls).toEqual([ |
| 125 | +[ |
| 126 | +[ |
| 127 | +"Agents:", |
| 128 | +"- main (default)", |
| 129 | +" Workspace: ~/.openclaw/workspace", |
| 130 | +" Agent dir: ~/.openclaw/agents/main/agent", |
| 131 | +" Routing rules: 1", |
| 132 | +" Routing: Telegram default", |
| 133 | +" Providers:", |
| 134 | +" - Telegram default: configured", |
| 135 | +"Routing rules map channel/account/peer to an agent. Use --bindings for full rules.", |
| 136 | +"Channel status reflects local config/creds. For live health: openclaw channels status --probe.", |
| 137 | +].join("\n"), |
| 138 | +], |
| 139 | +]); |
128 | 140 | }); |
129 | 141 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -52,7 +52,7 @@ describe("warnIfModelConfigLooksOff", () => {
|
52 | 52 | expect(profileStore?.profiles).toEqual({}); |
53 | 53 | expect(providerId).toBe("openai-codex"); |
54 | 54 | expect(note).toHaveBeenCalledWith( |
55 | | -expect.stringContaining('No auth configured for provider "openai-codex"'), |
| 55 | +'No auth configured for provider "openai-codex". The agent may fail until credentials are added. Run `openclaw models auth login --provider openai-codex`, `openclaw configure`, or set an API key env var.', |
56 | 56 | "Model check", |
57 | 57 | ); |
58 | 58 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -37,7 +37,13 @@ describe("command owner health", () => {
|
37 | 37 | noteCommandOwnerHealth({}); |
38 | 38 | |
39 | 39 | expect(note).toHaveBeenCalledWith( |
40 | | -expect.stringContaining("No command owner is configured."), |
| 40 | +[ |
| 41 | +"No command owner is configured.", |
| 42 | +"A command owner is the human operator account allowed to run owner-only commands and approve dangerous actions, including /diagnostics, /export-trajectory, /config, and exec approvals.", |
| 43 | +"DM pairing only lets someone talk to the bot; it does not make that sender the owner for privileged commands.", |
| 44 | +"Fix: set commands.ownerAllowFrom to your channel user id, for example openclaw config set commands.ownerAllowFrom '[\"telegram:123456789\"]'", |
| 45 | +"Restart the gateway after changing this if it is already running.", |
| 46 | +].join("\n"), |
41 | 47 | "Command owner", |
42 | 48 | ); |
43 | 49 | const message = String(note.mock.calls[0]?.[0] ?? ""); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,10 @@ describe("noteSourceInstallIssues", () => {
|
40 | 40 | noteSourceInstallIssues(root); |
41 | 41 | |
42 | 42 | expect(note).toHaveBeenCalledWith( |
43 | | -expect.stringContaining("node_modules was not installed by pnpm"), |
| 43 | +[ |
| 44 | +"- node_modules was not installed by pnpm (missing node_modules/.pnpm). Run: pnpm install so bundled plugins can load package-local dependencies.", |
| 45 | +"- tsx binary is missing for source runs. Run: pnpm install.", |
| 46 | +].join("\n"), |
44 | 47 | "Install", |
45 | 48 | ); |
46 | 49 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -99,7 +99,13 @@ describe("doctor WhatsApp responsiveness", () => {
|
99 | 99 | processes: [{ pid: 101, command: "openclaw-tui" }], |
100 | 100 | }); |
101 | 101 | expect(noteMock).toHaveBeenCalledWith( |
102 | | -expect.stringContaining("Stopped local TUI clients: 101"), |
| 102 | +[ |
| 103 | +"Gateway event loop is degraded while local TUI clients are running.", |
| 104 | +"WhatsApp replies can queue behind TUI startup/session refresh work.", |
| 105 | +"Local TUI pids: 101", |
| 106 | +"", |
| 107 | +"Stopped local TUI clients: 101", |
| 108 | +].join("\n"), |
103 | 109 | "WhatsApp responsiveness", |
104 | 110 | ); |
105 | 111 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,6 +21,9 @@ describe("printModelTable", () => {
|
21 | 21 | |
22 | 22 | printModelTable(rows, runtime as never); |
23 | 23 | |
24 | | -expect(runtime.log).toHaveBeenCalledWith(expect.stringContaining("266k/391k")); |
| 24 | +expect(runtime.log.mock.calls).toEqual([ |
| 25 | +["Model Input Ctx Local Auth Tags"], |
| 26 | +["openai-codex/gpt-5.5 text+image 266k/391k no yes "], |
| 27 | +]); |
25 | 28 | }); |
26 | 29 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -117,7 +117,12 @@ describe("promptRemoteGatewayConfig", () => {
|
117 | 117 | expect(next.gateway?.remote?.token).toBe("token-123"); |
118 | 118 | expect(next.gateway?.remote?.tlsFingerprint).toBe("sha256:abc123"); |
119 | 119 | expect(prompter.note).toHaveBeenCalledWith( |
120 | | -expect.stringContaining("Direct remote access defaults to TLS."), |
| 120 | +[ |
| 121 | +"Direct remote access defaults to TLS.", |
| 122 | +"Using: wss://gateway.tailnet.ts.net:18789", |
| 123 | +"TLS pin: sha256:abc123", |
| 124 | +"If your gateway is loopback-only, choose SSH tunnel and keep ws://127.0.0.1:18789.", |
| 125 | +].join("\n"), |
121 | 126 | "Direct remote", |
122 | 127 | ); |
123 | 128 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -105,7 +105,7 @@ describe("status.scan.config-shared", () => {
|
105 | 105 | }); |
106 | 106 | |
107 | 107 | expect(result.secretDiagnostics).toEqual([ |
108 | | -expect.stringContaining("OPENCLAW_GATEWAY_TOKEN conflicts with gateway.auth.token"), |
| 108 | +"OPENCLAW_GATEWAY_TOKEN conflicts with gateway.auth.token: Remove OPENCLAW_GATEWAY_TOKEN from the shell, ~/.openclaw/.env, or launchctl env if gateway.auth.token is intended, or point gateway.auth.token at ${OPENCLAW_GATEWAY_TOKEN} if the env var should be canonical.", |
109 | 109 | ]); |
110 | 110 | }); |
111 | 111 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。