Skip to content

Commit ad5fb49

Browse files
author
renkelvin
committed
Update recaptcha_enterprise_verifier.test.ts
1 parent 9a97aab commit ad5fb49

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

packages/auth/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
FAKE_TOKEN,
3939
handleRecaptchaFlow
4040
} from './recaptcha_enterprise_verifier';
41+
import { RecaptchaConfig } from './recaptcha';
4142
import { AuthErrorCode } from '../../core/errors';
4243
import { _createError } from '../../core/util/assert';
4344

@@ -57,6 +58,19 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
5758
}
5859
]
5960
};
61+
const recaptchaConfigEnforce = new RecaptchaConfig(
62+
recaptchaConfigResponseEnforce
63+
);
64+
const recaptchaConfigResponseOff = {
65+
recaptchaKey: 'foo/bar/to/site-key',
66+
recaptchaEnforcementState: [
67+
{
68+
provider: 'EMAIL_PASSWORD_PROVIDER',
69+
enforcementState: 'ENFORCE'
70+
}
71+
]
72+
};
73+
const recaptchaConfigOff = new RecaptchaConfig(recaptchaConfigResponseOff);
6074

6175
beforeEach(async () => {
6276
auth = await testAuth();
@@ -148,7 +162,7 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
148162
}
149163
sinon
150164
.stub(mockAuthInstance, '_getRecaptchaConfig')
151-
.returns({ emailPasswordEnabled: true, siteKey: 'mock_site_key' });
165+
.returns(recaptchaConfigEnforce);
152166
sinon
153167
.stub(RecaptchaEnterpriseVerifier.prototype, 'verify')
154168
.resolves('recaptcha-response');
@@ -171,7 +185,7 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
171185
}
172186
sinon
173187
.stub(mockAuthInstance, '_getRecaptchaConfig')
174-
.returns({ emailPasswordEnabled: false, siteKey: 'mock_site_key' });
188+
.returns(recaptchaConfigOff);
175189
sinon
176190
.stub(RecaptchaEnterpriseVerifier.prototype, 'verify')
177191
.resolves('recaptcha-response');
@@ -203,7 +217,7 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
203217
}
204218
sinon
205219
.stub(mockAuthInstance, '_getRecaptchaConfig')
206-
.returns({ emailPasswordEnabled: false, siteKey: 'mock_site_key' });
220+
.returns(recaptchaConfigOff);
207221
sinon
208222
.stub(RecaptchaEnterpriseVerifier.prototype, 'verify')
209223
.resolves('recaptcha-response');

0 commit comments

Comments
 (0)