test(line): cover secret-missing file-backed snapshots
This commit is contained in:
parent
24e03d5d28
commit
4c1fc56bd3
@ -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",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user