From 4774ddb6f76700a93813279d4d9f0b859f36d608 Mon Sep 17 00:00:00 2001 From: renkelvin Date: Mon, 2 Oct 2023 22:30:57 -0700 Subject: [PATCH] Update recaptcha_enterprise_verifier.test.ts --- .../recaptcha/recaptcha_enterprise_verifier.test.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/auth/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.ts b/packages/auth/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.ts index bc0b039b6f6..7853e7ea342 100644 --- a/packages/auth/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.ts +++ b/packages/auth/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.ts @@ -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' @@ -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' @@ -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' @@ -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 }); }); });