mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 08:41:13 +00:00
collectStatusIssues previously checked account.channelAccessToken directly, but this field is stripped by projectSafeChannelAccountSnapshotFields for security. This caused 'openclaw status' to always report WARN even when the token is valid and the LINE provider starts successfully. Use account.configured instead, which is already computed by buildChannelAccountSnapshot and correctly reflects whether credentials are present. This is consistent with how other channels (e.g. Telegram) implement their status checks. Fixes #45693
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { ChannelAccountSnapshot } from "../api.js";
|
|
import { linePlugin } from "./channel.js";
|
|
|
|
function collectIssues(accounts: ChannelAccountSnapshot[]) {
|
|
const collect = linePlugin.status?.collectStatusIssues;
|
|
if (!collect) {
|
|
throw new Error("LINE plugin status collector is unavailable");
|
|
}
|
|
return collect(accounts);
|
|
}
|
|
|
|
describe("linePlugin status.collectStatusIssues", () => {
|
|
it("does not warn when a sanitized snapshot is configured", () => {
|
|
expect(
|
|
collectIssues([
|
|
{
|
|
accountId: "default",
|
|
configured: true,
|
|
tokenSource: "env",
|
|
},
|
|
]),
|
|
).toEqual([]);
|
|
});
|
|
|
|
it("reports missing access token when the snapshot is unconfigured and tokenSource is none", () => {
|
|
expect(
|
|
collectIssues([
|
|
{
|
|
accountId: "default",
|
|
configured: false,
|
|
tokenSource: "none",
|
|
},
|
|
]),
|
|
).toEqual([
|
|
{
|
|
channel: "line",
|
|
accountId: "default",
|
|
kind: "config",
|
|
message: "LINE channel access token not configured",
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("reports missing secret when the snapshot is unconfigured but a token source exists", () => {
|
|
expect(
|
|
collectIssues([
|
|
{
|
|
accountId: "default",
|
|
configured: false,
|
|
tokenSource: "env",
|
|
},
|
|
]),
|
|
).toEqual([
|
|
{
|
|
channel: "line",
|
|
accountId: "default",
|
|
kind: "config",
|
|
message: "LINE channel secret not configured",
|
|
},
|
|
]);
|
|
});
|
|
});
|