Update enums to be all caps (#12372)

- Make custom domain public (remove from lab)
- Use ALL_CAPS definition for enums
This commit is contained in:
Félix Malfait
2025-05-29 14:08:36 +02:00
committed by GitHub
parent 76d0be7f81
commit 4485e8e3db
165 changed files with 845 additions and 847 deletions

View File

@ -7,7 +7,7 @@ import { getCaptchaUrlByProvider } from '../getCaptchaUrlByProvider';
describe('getCaptchaUrlByProvider', () => {
it('handles GoogleRecaptcha', async () => {
const captchaUrl = getCaptchaUrlByProvider(
CaptchaDriverType.GoogleRecaptcha,
CaptchaDriverType.GOOGLE_RECAPTCHA,
'siteKey',
);
@ -16,14 +16,14 @@ describe('getCaptchaUrlByProvider', () => {
);
expect(() =>
getCaptchaUrlByProvider(CaptchaDriverType.GoogleRecaptcha, ''),
getCaptchaUrlByProvider(CaptchaDriverType.GOOGLE_RECAPTCHA, ''),
).toThrow(
'SiteKey must be provided while generating url for GoogleRecaptcha provider',
);
});
it('handles Turnstile', async () => {
const captchaUrl = getCaptchaUrlByProvider(CaptchaDriverType.Turnstile, '');
const captchaUrl = getCaptchaUrlByProvider(CaptchaDriverType.TURNSTILE, '');
expect(captchaUrl).toEqual(
'https://challenges.cloudflare.com/turnstile/v0/api.js',

View File

@ -7,14 +7,14 @@ export const getCaptchaUrlByProvider = (
siteKey: string,
) => {
switch (name) {
case CaptchaDriverType.GoogleRecaptcha:
case CaptchaDriverType.GOOGLE_RECAPTCHA:
if (!isNonEmptyString(siteKey)) {
throw new Error(
'SiteKey must be provided while generating url for GoogleRecaptcha provider',
);
}
return `https://www.google.com/recaptcha/api.js?render=${siteKey}`;
case CaptchaDriverType.Turnstile:
case CaptchaDriverType.TURNSTILE:
return 'https://challenges.cloudflare.com/turnstile/v0/api.js';
default:
throw new Error('Unknown captcha provider');