From 4c1fc56bd30b032669503cef0d69fe6ca417eb6c Mon Sep 17 00:00:00 2001 From: jackal092927 Date: Wed, 11 Mar 2026 01:50:35 -0400 Subject: [PATCH] test(line): cover secret-missing file-backed snapshots --- extensions/line/src/channel.startup.test.ts | 62 +++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/extensions/line/src/channel.startup.test.ts b/extensions/line/src/channel.startup.test.ts index f5a6dd7310e..81a85ff89e7 100644 --- a/extensions/line/src/channel.startup.test.ts +++ b/extensions/line/src/channel.startup.test.ts @@ -179,4 +179,66 @@ describe("linePlugin status", () => { }, ]); }); + + it("keeps per-field warnings when only the channel secret is missing", async () => { + const snapshot = await linePlugin.status?.buildAccountSnapshot?.({ + account: { + accountId: "default", + name: "Default", + enabled: true, + channelAccessToken: "token-from-file", + channelSecret: " ", + tokenSource: "file", + config: {} as ResolvedLineAccount["config"], + } as never, + cfg: {} as OpenClawConfig, + runtime: undefined, + probe: undefined, + audit: undefined, + }); + + expect(snapshot?.configured).toBe(false); + expect(linePlugin.status?.collectStatusIssues?.([snapshot as never])).toEqual([ + { + channel: "line", + accountId: "default", + kind: "config", + message: "LINE channel secret not configured", + }, + ]); + }); + + it("reports both warnings when both file-backed credentials are missing", async () => { + const snapshot = await linePlugin.status?.buildAccountSnapshot?.({ + account: { + accountId: "default", + name: "Default", + enabled: true, + channelAccessToken: " ", + channelSecret: " ", + tokenSource: "file", + config: {} as ResolvedLineAccount["config"], + } as never, + cfg: {} as OpenClawConfig, + runtime: undefined, + probe: undefined, + audit: undefined, + }); + + expect(snapshot?.configured).toBe(false); + expect(linePlugin.status?.collectStatusIssues?.([snapshot as never])).toEqual([ + { + channel: "line", + accountId: "default", + kind: "config", + message: "LINE channel access token not configured", + }, + { + channel: "line", + accountId: "default", + kind: "config", + message: "LINE channel secret not configured", + }, + ]); + }); });