Skip to content

Commit 99c13e6

Browse files
author
renkelvin
committed
address pr issues
1 parent 1874faa commit 99c13e6

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/auth/src/core/credentials/email.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe('core/credentials/email', () => {
196196
window.grecaptcha = recaptcha;
197197
const stub = sinon.stub(recaptcha.enterprise, 'execute');
198198

199-
// First verification should fail with 'wrong-site-key'
199+
// Force first verification call to fail to simulate verification error
200200
// Second verifcation should succeed with site key refreshed
201201
stub.onCall(0).rejects();
202202
stub.onCall(1).returns(Promise.resolve('recaptcha-response'));
@@ -210,7 +210,7 @@ describe('core/credentials/email', () => {
210210
recaptchaConfigResponseEnforce
211211
);
212212
await auth.initializeRecaptchaConfig();
213-
auth._agentRecaptchaConfig!.siteKey = 'wrong-site-key';
213+
auth._agentRecaptchaConfig!.siteKey = 'cached-site-key';
214214

215215
const idTokenResponse = await credential._getIdTokenResponse(auth);
216216
expect(idTokenResponse.idToken).to.eq('id-token');

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ import * as mockFetch from '../../../test/helpers/mock_fetch';
2727
import { ServerError } from '../../api/errors';
2828

2929
import { MockGreCAPTCHATopLevel } from './recaptcha_mock';
30-
import { RecaptchaEnterpriseVerifier } from './recaptcha_enterprise_verifier';
30+
import {
31+
RecaptchaEnterpriseVerifier,
32+
FAKE_TOKEN
33+
} from './recaptcha_enterprise_verifier';
3134

3235
use(chaiAsPromised);
3336
use(sinonChai);
@@ -81,7 +84,7 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
8184
expect(await verifier.verify()).to.eq('recaptcha-response');
8285
});
8386

84-
it('reject if error is thrown when retieve site key', async () => {
87+
it('reject if error is thrown when retrieve site key', async () => {
8588
mockEndpointWithParams(
8689
Endpoint.GET_RECAPTCHA_CONFIG,
8790
request,
@@ -102,16 +105,16 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
102105
);
103106
});
104107

105-
it('return fake recaptcha token if error is thrown when retieve recaptcha token', async () => {
108+
it('return fake recaptcha token if error is thrown when retrieve recaptcha token', async () => {
106109
mockEndpointWithParams(
107110
Endpoint.GET_RECAPTCHA_CONFIG,
108111
request,
109112
recaptchaConfigResponseEnforce
110113
);
111114
sinon
112115
.stub(recaptcha.enterprise, 'execute')
113-
.returns(Promise.reject(Error('retieve-recaptcha-token-error')));
114-
expect(await verifier.verify()).to.eq('NO_RECAPTCHA');
116+
.returns(Promise.reject(Error('retrieve-recaptcha-token-error')));
117+
expect(await verifier.verify()).to.eq(FAKE_TOKEN);
115118
});
116119
});
117120
});

0 commit comments

Comments
 (0)