release: WRNexusJS 0.4.0

This commit is contained in:
2026-07-27 12:42:18 +05:30
parent 8b728a3e5d
commit 30e5721e84
250 changed files with 10065 additions and 3923 deletions
+11 -2
View File
@@ -3,7 +3,11 @@ import { evaluateCaptchaRisk, shouldRequireCaptcha, validCaptchaGrant } from "..
describe("adaptive CAPTCHA policy", () => {
test("raises risk from automation signals", () => {
const result = evaluateCaptchaRisk({ failedAttempts: 3, completionMs: 200, suspiciousHeaders: true });
const result = evaluateCaptchaRisk({
failedAttempts: 3,
completionMs: 200,
suspiciousHeaders: true,
});
expect(result.challenge).toBe(true);
expect(result.reasons).toContain("too-fast");
});
@@ -14,7 +18,12 @@ describe("adaptive CAPTCHA policy", () => {
});
test("accepts an unexpired route grant", () => {
const grant = validCaptchaGrant([{ action: "page", routeGroup: "/reports", provider: "self-hosted", expiresAt: 200 }], "page", 100, "/reports");
const grant = validCaptchaGrant(
[{ action: "page", routeGroup: "/reports", provider: "self-hosted", expiresAt: 200 }],
"page",
100,
"/reports",
);
expect(grant?.provider).toBe("self-hosted");
});
});