You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

13 lines
525 B

import { describe, expect, test } from "bun:test";
import { createCaptchaChallenge } from "./challenge";
describe("createCaptchaChallenge", () => {
test("returns captchaId and non-empty svg", () => {
const { captchaId, imageSvg } = createCaptchaChallenge();
expect(captchaId).toMatch(
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
);
expect(imageSvg.length).toBeGreaterThan(50);
expect(imageSvg.includes("svg")).toBe(true);
});
});