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:
@ -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',
|
||||
|
||||
@ -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');
|
||||
|
||||
Reference in New Issue
Block a user