release: WRNexusJS 0.5.10
This commit is contained in:
@@ -49,6 +49,22 @@ function fixture() {
|
||||
}
|
||||
|
||||
describe("self-hosted CAPTCHA engine", () => {
|
||||
test("random challenges resolve to an interactive challenge type", async () => {
|
||||
const engine = createCaptchaEngine({
|
||||
secret: "captcha-test-secret-with-at-least-thirty-two-characters",
|
||||
store: new MemoryCaptchaStore(),
|
||||
defaultType: "random",
|
||||
minCompletionMs: 0,
|
||||
});
|
||||
const supported = new Set(["number", "alpha", "alphanumeric", "calculation", "image"]);
|
||||
|
||||
for (let index = 0; index < 12; index += 1) {
|
||||
const challenge = await engine.create({ action: "random-check" });
|
||||
expect(supported.has(challenge.type)).toBe(true);
|
||||
expect(challenge.type).not.toBe("random");
|
||||
}
|
||||
});
|
||||
|
||||
test("creates, solves, and consumes a challenge and response token", async () => {
|
||||
const { engine } = fixture();
|
||||
const challenge = await engine.create({
|
||||
|
||||
Reference in New Issue
Block a user