@@ -38,6 +38,7 @@ import {
38
38
FAKE_TOKEN ,
39
39
handleRecaptchaFlow
40
40
} from './recaptcha_enterprise_verifier' ;
41
+ import { RecaptchaConfig } from './recaptcha' ;
41
42
import { AuthErrorCode } from '../../core/errors' ;
42
43
import { _createError } from '../../core/util/assert' ;
43
44
@@ -57,6 +58,19 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
57
58
}
58
59
]
59
60
} ;
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 ) ;
60
74
61
75
beforeEach ( async ( ) => {
62
76
auth = await testAuth ( ) ;
@@ -148,7 +162,7 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
148
162
}
149
163
sinon
150
164
. stub ( mockAuthInstance , '_getRecaptchaConfig' )
151
- . returns ( { emailPasswordEnabled : true , siteKey : 'mock_site_key' } ) ;
165
+ . returns ( recaptchaConfigEnforce ) ;
152
166
sinon
153
167
. stub ( RecaptchaEnterpriseVerifier . prototype , 'verify' )
154
168
. resolves ( 'recaptcha-response' ) ;
@@ -171,7 +185,7 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
171
185
}
172
186
sinon
173
187
. stub ( mockAuthInstance , '_getRecaptchaConfig' )
174
- . returns ( { emailPasswordEnabled : false , siteKey : 'mock_site_key' } ) ;
188
+ . returns ( recaptchaConfigOff ) ;
175
189
sinon
176
190
. stub ( RecaptchaEnterpriseVerifier . prototype , 'verify' )
177
191
. resolves ( 'recaptcha-response' ) ;
@@ -203,7 +217,7 @@ describe('platform_browser/recaptcha/recaptcha_enterprise_verifier', () => {
203
217
}
204
218
sinon
205
219
. stub ( mockAuthInstance , '_getRecaptchaConfig' )
206
- . returns ( { emailPasswordEnabled : false , siteKey : 'mock_site_key' } ) ;
220
+ . returns ( recaptchaConfigOff ) ;
207
221
sinon
208
222
. stub ( RecaptchaEnterpriseVerifier . prototype , 'verify' )
209
223
. resolves ( 'recaptcha-response' ) ;
0 commit comments