test: verify channel warning values · openclaw/openclaw@9a1de1c
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -126,8 +126,8 @@ describe("signal groups schema", () => {
|
126 | 126 | }, |
127 | 127 | }); |
128 | 128 | |
129 | | -expect(issues.map((issue) => issue.path.join("."))).toContainEqual( |
130 | | -expect.stringMatching(/^groups/), |
131 | | -); |
| 129 | +expect( |
| 130 | +issues.map((issue) => issue.path.join(".")).some((entry) => entry.startsWith("groups")), |
| 131 | +).toBe(true); |
132 | 132 | }); |
133 | 133 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -168,7 +168,9 @@ describe("resolveDefaultTelegramAccountId", () => {
|
168 | 168 | |
169 | 169 | const result = resolveDefaultTelegramAccountId(cfg); |
170 | 170 | expect(result).toBe("alerts"); |
171 | | -expect(warnMock).toHaveBeenCalledWith(expect.stringContaining("accounts.default is missing")); |
| 171 | +expect(warnMock).toHaveBeenCalledWith( |
| 172 | +'channels.telegram: accounts.default is missing; falling back to "alerts". Set channels.telegram.defaultAccount or add channels.telegram.accounts.default to avoid routing surprises in multi-account setups.', |
| 173 | +); |
172 | 174 | }); |
173 | 175 | |
174 | 176 | it("does not warn when accounts.default exists", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -375,7 +375,7 @@ describe("handleTelegramAction", () => {
|
375 | 375 | expect(options.mediaUrl).toBeUndefined(); |
376 | 376 | expect(result.content).toContainEqual({ |
377 | 377 | type: "text", |
378 | | -text: expect.stringContaining('"ok": true'), |
| 378 | +text: '{\n "ok": true,\n "messageId": "789",\n "chatId": "123"\n}', |
379 | 379 | }); |
380 | 380 | }); |
381 | 381 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -198,7 +198,9 @@ describe("telegram bot message processor", () => {
|
198 | 198 | "Something went wrong while processing your request. Please try again.", |
199 | 199 | { message_thread_id: 456 }, |
200 | 200 | ); |
201 | | -expect(runtimeError).toHaveBeenCalledWith(expect.stringContaining("dispatch exploded")); |
| 201 | +expect(runtimeError).toHaveBeenCalledWith( |
| 202 | +"telegram message processing failed: Error: dispatch exploded", |
| 203 | +); |
202 | 204 | }); |
203 | 205 | |
204 | 206 | it("omits message_thread_id for General-topic fallback replies", async () => { |
@@ -236,6 +238,8 @@ describe("telegram bot message processor", () => {
|
236 | 238 | "Something went wrong while processing your request. Please try again.", |
237 | 239 | undefined, |
238 | 240 | ); |
239 | | -expect(runtimeError).toHaveBeenCalledWith(expect.stringContaining("dispatch exploded")); |
| 241 | +expect(runtimeError).toHaveBeenCalledWith( |
| 242 | +"telegram message processing failed: Error: dispatch exploded", |
| 243 | +); |
240 | 244 | }); |
241 | 245 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -112,7 +112,7 @@ describe("telegramPlugin gateway startup", () => {
|
112 | 112 | await expect(task).rejects.toThrow("channels.telegram.accounts.ops.botToken/tokenFile"); |
113 | 113 | expect(monitorTelegramProvider).not.toHaveBeenCalled(); |
114 | 114 | expect(ctx.log?.error).toHaveBeenCalledWith( |
115 | | -expect.stringContaining('Telegram bot token unauthorized for account "ops"'), |
| 115 | +'[ops] Telegram bot token unauthorized for account "ops" (getMe returned 401 from Telegram; source: config token). Update channels.telegram.accounts.ops.botToken/tokenFile with the current BotFather token.', |
116 | 116 | ); |
117 | 117 | }); |
118 | 118 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -481,9 +481,9 @@ describe("telegram doctor", () => {
|
481 | 481 | configured: false, |
482 | 482 | config: {}, |
483 | 483 | }); |
484 | | -expect(collectTelegramMissingEnvTokenWarnings({ cfg, env: {} })).toEqual([ |
485 | | -expect.stringContaining("TELEGRAM_BOT_TOKEN is absent"), |
486 | | -]); |
| 484 | +const missingEnvWarning = |
| 485 | +"- channels.telegram: default account has no available bot token, and TELEGRAM_BOT_TOKEN is absent in this doctor environment. After migration, verify TELEGRAM_BOT_TOKEN is present in the state-dir .env or configure channels.telegram.botToken / channels.telegram.accounts.default.botToken as a SecretRef."; |
| 486 | +expect(collectTelegramMissingEnvTokenWarnings({ cfg, env: {} })).toEqual([missingEnvWarning]); |
487 | 487 | |
488 | 488 | inspectTelegramAccountMock.mockReturnValueOnce({ |
489 | 489 | enabled: true, |
@@ -511,7 +511,7 @@ describe("telegram doctor", () => {
|
511 | 511 | doctorFixCommand: "openclaw doctor --fix", |
512 | 512 | env: {}, |
513 | 513 | }), |
514 | | -).toContainEqual(expect.stringContaining("TELEGRAM_BOT_TOKEN is absent")); |
| 514 | +).toContain(missingEnvWarning); |
515 | 515 | }); |
516 | 516 | |
517 | 517 | it("does not warn about TELEGRAM_BOT_TOKEN when a non-default account is selected", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。