Skip to content

Commit

Permalink
Update recaptcha_enterprise_verifier.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
renkelvin committed Oct 3, 2023
1 parent e834c72 commit 4774ddb
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
});

it('should handle recaptcha when emailPasswordEnabled is true', async () => {
if (typeof window === 'undefined') {
return;
}
sinon.stub(mockAuthInstance, '_getRecaptchaConfig').returns({
emailPasswordEnabled: true,
siteKey: 'mock_site_key'
Expand All @@ -156,10 +159,12 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {

expect(result).to.equal('success');
expect(mockActionMethod).to.have.been.calledOnce;
// Add more assertions as needed, e.g., checking if injectRecaptchaFields was called
});

it('should handle action without recaptcha when emailPasswordEnabled is false and no error', async () => {
if (typeof window === 'undefined') {
return;
}
sinon.stub(mockAuthInstance, '_getRecaptchaConfig').returns({
emailPasswordEnabled: false,
siteKey: 'mock_site_key'
Expand All @@ -178,6 +183,9 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
});

it('should handle MISSING_RECAPTCHA_TOKEN error when emailPasswordEnabled is false', async () => {
if (typeof window === 'undefined') {
return;
}
sinon.stub(mockAuthInstance, '_getRecaptchaConfig').returns({
emailPasswordEnabled: false,
siteKey: 'mock_site_key'
Expand All @@ -196,7 +204,6 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {

expect(result).to.equal('success-after-recaptcha');
expect(mockActionMethod).to.have.been.calledTwice;
// Add more assertions as needed, e.g., checking if injectRecaptchaFields was called
});
});
});

0 comments on commit 4774ddb

Please sign in to comment.