mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 00:10:42 +00:00
test: tighten channel readonly assertion
This commit is contained in:
@@ -31,6 +31,19 @@ function stubChannelPlugin(params: {
|
||||
};
|
||||
}
|
||||
|
||||
function requireReadOnlyResolutionFinding(
|
||||
findings: Awaited<ReturnType<typeof collectChannelSecurityFindings>>,
|
||||
) {
|
||||
const finding = findings.find(
|
||||
(entry) => entry.checkId === "channels.zalouser.account.read_only_resolution",
|
||||
);
|
||||
expect(finding).toBeDefined();
|
||||
if (!finding) {
|
||||
throw new Error("Expected Zalo read-only resolution warning");
|
||||
}
|
||||
return finding;
|
||||
}
|
||||
|
||||
describe("security audit channel read-only resolution", () => {
|
||||
it("adds a read-only resolution warning when channel account resolveAccount throws", async () => {
|
||||
const plugin = stubChannelPlugin({
|
||||
@@ -54,12 +67,10 @@ describe("security audit channel read-only resolution", () => {
|
||||
plugins: [plugin],
|
||||
});
|
||||
|
||||
const finding = findings.find(
|
||||
(entry) => entry.checkId === "channels.zalouser.account.read_only_resolution",
|
||||
);
|
||||
expect(finding?.severity).toBe("warn");
|
||||
expect(finding?.title).toContain("could not be fully resolved");
|
||||
expect(finding?.detail).toContain("zalouser:default: failed to resolve account");
|
||||
expect(finding?.detail).toContain("missing SecretRef");
|
||||
const finding = requireReadOnlyResolutionFinding(findings);
|
||||
expect(finding.severity).toBe("warn");
|
||||
expect(finding.title).toContain("could not be fully resolved");
|
||||
expect(finding.detail).toContain("zalouser:default: failed to resolve account");
|
||||
expect(finding.detail).toContain("missing SecretRef");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user