mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 11:20:43 +00:00
test: tighten probe failure assertion
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { collectDeepProbeFindings } from "./audit-deep-probe-findings.js";
|
||||
|
||||
function requireProbeFailure(findings: ReturnType<typeof collectDeepProbeFindings>) {
|
||||
const finding = findings.find((entry) => entry.checkId === "gateway.probe_failed");
|
||||
expect(finding).toBeDefined();
|
||||
if (!finding) {
|
||||
throw new Error("Expected gateway probe failure finding");
|
||||
}
|
||||
return finding;
|
||||
}
|
||||
|
||||
describe("security audit deep probe failure", () => {
|
||||
it("adds probe_failed warnings for deep probe failure modes", () => {
|
||||
const cases: Array<{
|
||||
@@ -46,12 +55,8 @@ describe("security audit deep probe failure", () => {
|
||||
|
||||
for (const testCase of cases) {
|
||||
const findings = collectDeepProbeFindings({ deep: testCase.deep });
|
||||
expect(
|
||||
findings.some((finding) => finding.checkId === "gateway.probe_failed"),
|
||||
testCase.name,
|
||||
).toBe(true);
|
||||
const probeFailure = findings.find((finding) => finding.checkId === "gateway.probe_failed");
|
||||
expect(probeFailure?.detail, testCase.name).toContain(testCase.expectedError);
|
||||
const probeFailure = requireProbeFailure(findings);
|
||||
expect(probeFailure.detail, testCase.name).toContain(testCase.expectedError);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user