Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -32,6 +32,26 @@ describe("verifyCaptchaToken", () => {
|
||||
expect(calledBody).toEqual({ token: "pow-token", key: "site-key", secret: "account-secret" });
|
||||
});
|
||||
|
||||
it("returns true when Cap reports success", async () => {
|
||||
let calledUrl = "";
|
||||
let calledBody: unknown = null;
|
||||
const fetchImpl = (async (url: string, init?: RequestInit) => {
|
||||
calledUrl = url;
|
||||
calledBody = JSON.parse(String(init?.body));
|
||||
return jsonResponse({ success: true });
|
||||
}) as unknown as typeof fetch;
|
||||
|
||||
const ok = await verifyCaptchaToken({ ...base, provider: "cap", fetchImpl });
|
||||
expect(ok).toBe(true);
|
||||
expect(calledUrl).toBe("https://captcha.example.test/site-key/siteverify");
|
||||
expect(calledBody).toEqual({ response: "pow-token", secret: "account-secret" });
|
||||
});
|
||||
|
||||
it("returns false when Cap reports failure", async () => {
|
||||
const fetchImpl = (async () => jsonResponse({ success: false })) as unknown as typeof fetch;
|
||||
expect(await verifyCaptchaToken({ ...base, provider: "cap", fetchImpl })).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false when mCaptcha reports invalid", async () => {
|
||||
const fetchImpl = (async () => jsonResponse({ valid: false })) as unknown as typeof fetch;
|
||||
expect(await verifyCaptchaToken({ ...base, fetchImpl })).toBe(false);
|
||||
|
||||
Reference in new issue
Block a user