Fix LINE doctor warnings for file-backed credentials
This commit is contained in:
parent
14bbcad169
commit
73e641c1b4
@ -129,3 +129,54 @@ describe("linePlugin gateway.startAccount", () => {
|
||||
await task;
|
||||
});
|
||||
});
|
||||
|
||||
describe("linePlugin status", () => {
|
||||
it("does not report missing token or secret when snapshot came from file-backed config", async () => {
|
||||
const snapshot = await linePlugin.status?.buildAccountSnapshot?.({
|
||||
account: {
|
||||
accountId: "default",
|
||||
name: "Default",
|
||||
enabled: true,
|
||||
channelAccessToken: "token-from-file",
|
||||
channelSecret: "secret-from-file",
|
||||
tokenSource: "file",
|
||||
config: {} as ResolvedLineAccount["config"],
|
||||
} as never,
|
||||
cfg: {} as OpenClawConfig,
|
||||
runtime: undefined,
|
||||
probe: undefined,
|
||||
audit: undefined,
|
||||
});
|
||||
|
||||
expect(snapshot?.configured).toBe(true);
|
||||
expect(linePlugin.status?.collectStatusIssues?.([snapshot as never])).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps per-field warnings when only one credential is missing", async () => {
|
||||
const snapshot = await linePlugin.status?.buildAccountSnapshot?.({
|
||||
account: {
|
||||
accountId: "default",
|
||||
name: "Default",
|
||||
enabled: true,
|
||||
channelAccessToken: " ",
|
||||
channelSecret: "secret-from-file",
|
||||
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",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@ -569,7 +569,7 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
|
||||
const issues: ChannelStatusIssue[] = [];
|
||||
for (const account of accounts) {
|
||||
const accountId = account.accountId ?? DEFAULT_ACCOUNT_ID;
|
||||
if (!account.channelAccessToken?.trim()) {
|
||||
if (account.channelAccessTokenConfigured === false) {
|
||||
issues.push({
|
||||
channel: "line",
|
||||
accountId,
|
||||
@ -577,7 +577,7 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
|
||||
message: "LINE channel access token not configured",
|
||||
});
|
||||
}
|
||||
if (!account.channelSecret?.trim()) {
|
||||
if (account.channelSecretConfigured === false) {
|
||||
issues.push({
|
||||
channel: "line",
|
||||
accountId,
|
||||
@ -605,6 +605,8 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
|
||||
});
|
||||
return {
|
||||
...base,
|
||||
channelAccessTokenConfigured: Boolean(account.channelAccessToken?.trim()),
|
||||
channelSecretConfigured: Boolean(account.channelSecret?.trim()),
|
||||
tokenSource: account.tokenSource,
|
||||
mode: "webhook",
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user