Skip to content

Commit 15ec2b5

Browse files
author
renkelvin
committed
Revert tests
1 parent 22f1369 commit 15ec2b5

File tree

1 file changed

+2
-91
lines changed

1 file changed

+2
-91
lines changed

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

Lines changed: 2 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,16 @@ import chaiAsPromised from 'chai-as-promised';
2020
import * as sinon from 'sinon';
2121
import sinonChai from 'sinon-chai';
2222

23-
import {
24-
Endpoint,
25-
RecaptchaClientType,
26-
RecaptchaVersion,
27-
RecaptchaActionName
28-
} from '../../api';
23+
import { Endpoint, RecaptchaClientType, RecaptchaVersion } from '../../api';
2924
import { mockEndpointWithParams } from '../../../test/helpers/api/helper';
3025
import { testAuth, TestAuth } from '../../../test/helpers/mock_auth';
3126
import * as mockFetch from '../../../test/helpers/mock_fetch';
3227
import { ServerError } from '../../api/errors';
33-
import { AuthInternal } from '../../model/auth';
3428

3529
import { MockGreCAPTCHATopLevel } from './recaptcha_mock';
3630
import {
3731
RecaptchaEnterpriseVerifier,
38-
FAKE_TOKEN,
39-
handleRecaptchaFlow
32+
FAKE_TOKEN
4033
} from './recaptcha_enterprise_verifier';
4134

4235
use(chaiAsPromised);
@@ -124,86 +117,4 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
124117
expect(await verifier.verify()).to.eq(FAKE_TOKEN);
125118
});
126119
});
127-
128-
context('handleRecaptchaFlow', () => {
129-
let mockAuthInstance: AuthInternal;
130-
let mockRequest: any;
131-
let mockActionMethod: sinon.SinonStub;
132-
133-
beforeEach(async () => {
134-
mockAuthInstance = await testAuth();
135-
mockRequest = {};
136-
mockActionMethod = sinon.stub();
137-
});
138-
139-
afterEach(() => {
140-
sinon.restore();
141-
});
142-
143-
it('should handle recaptcha when emailPasswordEnabled is true', async () => {
144-
if (typeof window === 'undefined') {
145-
return;
146-
}
147-
sinon.stub(mockAuthInstance, '_getRecaptchaConfig').returns({
148-
emailPasswordEnabled: true,
149-
siteKey: 'mock_site_key'
150-
});
151-
mockActionMethod.resolves('success');
152-
153-
const result = await handleRecaptchaFlow(
154-
mockAuthInstance,
155-
mockRequest,
156-
RecaptchaActionName.GET_OOB_CODE,
157-
mockActionMethod
158-
);
159-
160-
expect(result).to.equal('success');
161-
expect(mockActionMethod).to.have.been.calledOnce;
162-
});
163-
164-
it('should handle action without recaptcha when emailPasswordEnabled is false and no error', async () => {
165-
if (typeof window === 'undefined') {
166-
return;
167-
}
168-
sinon.stub(mockAuthInstance, '_getRecaptchaConfig').returns({
169-
emailPasswordEnabled: false,
170-
siteKey: 'mock_site_key'
171-
});
172-
mockActionMethod.resolves('success');
173-
174-
const result = await handleRecaptchaFlow(
175-
mockAuthInstance,
176-
mockRequest,
177-
RecaptchaActionName.GET_OOB_CODE,
178-
mockActionMethod
179-
);
180-
181-
expect(result).to.equal('success');
182-
expect(mockActionMethod).to.have.been.calledOnce;
183-
});
184-
185-
it('should handle MISSING_RECAPTCHA_TOKEN error when emailPasswordEnabled is false', async () => {
186-
if (typeof window === 'undefined') {
187-
return;
188-
}
189-
sinon.stub(mockAuthInstance, '_getRecaptchaConfig').returns({
190-
emailPasswordEnabled: false,
191-
siteKey: 'mock_site_key'
192-
});
193-
mockActionMethod.onFirstCall().rejects({
194-
code: 'auth/MISSING_RECAPTCHA_TOKEN'
195-
});
196-
mockActionMethod.onSecondCall().resolves('success-after-recaptcha');
197-
198-
const result = await handleRecaptchaFlow(
199-
mockAuthInstance,
200-
mockRequest,
201-
RecaptchaActionName.GET_OOB_CODE,
202-
mockActionMethod
203-
);
204-
205-
expect(result).to.equal('success-after-recaptcha');
206-
expect(mockActionMethod).to.have.been.calledTwice;
207-
});
208-
});
209120
});

0 commit comments

Comments
 (0)