From 561c19cb58c53cc34e4a65dfd204b7ab2e82ca85 Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 11 May 2026 16:40:05 +0100 Subject: [PATCH] test: verify plugin warning messages --- extensions/feishu/src/monitor.comment.test.ts | 6 ++--- extensions/irc/src/inbound.behavior.test.ts | 23 ++++++++++++------- .../matrix/src/startup-maintenance.test.ts | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/extensions/feishu/src/monitor.comment.test.ts b/extensions/feishu/src/monitor.comment.test.ts index 9e7490f7f9d..d4b4743f8ef 100644 --- a/extensions/feishu/src/monitor.comment.test.ts +++ b/extensions/feishu/src/monitor.comment.test.ts @@ -909,7 +909,7 @@ describe("drive.notice.comment_add_v1 monitor handler", () => { "default", ); expect(lastRuntime?.error).toHaveBeenCalledWith( - expect.stringContaining("error handling drive comment notice: Error: post-send failure"), + "feishu[default]: error handling drive comment notice: Error: post-send failure", ); }); const [recordedMessageId, recordedNamespace, recordedLogger] = @@ -936,9 +936,7 @@ describe("drive.notice.comment_add_v1 monitor handler", () => { "default", ); expect(lastRuntime?.error).toHaveBeenCalledWith( - expect.stringContaining( - "error handling drive comment notice: FeishuRetryableSyntheticEventError: retry me", - ), + "feishu[default]: error handling drive comment notice: FeishuRetryableSyntheticEventError: retry me", ); }); }); diff --git a/extensions/irc/src/inbound.behavior.test.ts b/extensions/irc/src/inbound.behavior.test.ts index 2c9c2a1f955..480992cce88 100644 --- a/extensions/irc/src/inbound.behavior.test.ts +++ b/extensions/irc/src/inbound.behavior.test.ts @@ -123,16 +123,23 @@ describe("irc inbound behavior", () => { expect(sendReply).toHaveBeenCalledTimes(1); expect(sendReply).toHaveBeenCalledWith( "alice", - expect.stringContaining("OpenClaw: access not configured."), + [ + "OpenClaw: access not configured.", + "", + "Your IRC id: alice!ident@example.com", + "Pairing code:", + "```", + "CODE", + "```", + "", + "Ask the bot owner to approve with:", + "openclaw pairing approve irc CODE", + "```", + "openclaw pairing approve irc CODE", + "```", + ].join("\n"), undefined, ); - expect(sendReply).toHaveBeenCalledWith( - "alice", - expect.stringContaining("Your IRC id: alice!ident@example.com"), - undefined, - ); - const replyMessages = sendReply.mock.calls.map((call) => call[1]); - expect(replyMessages.some((message) => message.includes("CODE"))).toBe(true); }); it("drops unauthorized group control commands before dispatch", async () => { diff --git a/extensions/matrix/src/startup-maintenance.test.ts b/extensions/matrix/src/startup-maintenance.test.ts index 511bd2410fd..152fdc277e3 100644 --- a/extensions/matrix/src/startup-maintenance.test.ts +++ b/extensions/matrix/src/startup-maintenance.test.ts @@ -142,7 +142,7 @@ describe("runMatrixStartupMaintenance", () => { expectWarningOnlyMaintenanceSkipped(harness); expect(harness.log.warn).toHaveBeenCalledWith( - expect.stringContaining("could not be resolved yet"), + `matrix: Legacy Matrix state detected at ${path.join(home, ".openclaw", "matrix")}, but the new account-scoped target could not be resolved yet (need homeserver, userId, and access token for channels.matrix). Start the gateway once with a working Matrix login, or rerun "openclaw doctor --fix" after cached credentials are available.`, ); }); });