@@ -1325,7 +1325,7 @@ describe('admin.auth', () => {
13251325 } ,
13261326 } ;
13271327
1328- const expectedRecaptchaConfig2 : any = {
1328+ const expectedRecaptchaOffConfig : any = {
13291329 emailPasswordEnforcementState : 'OFF' ,
13301330 phoneEnforcementState : 'OFF' ,
13311331 managedRules : [
@@ -1348,14 +1348,15 @@ describe('admin.auth', () => {
13481348 smsRegionConfig : smsRegionAllowlistOnlyConfig ,
13491349 multiFactorConfig : mfaSmsEnabledTotpEnabledConfig ,
13501350 passwordPolicyConfig : passwordConfig ,
1351- recaptchaConfig : expectedRecaptchaConfig2 ,
1351+ recaptchaConfig : expectedRecaptchaOffConfig ,
13521352 emailPrivacyConfig : { } ,
13531353 } ;
1354+
13541355 const expectedProjectConfigSmsEnabledTotpDisabled : any = {
13551356 smsRegionConfig : smsRegionAllowlistOnlyConfig ,
13561357 multiFactorConfig : mfaSmsEnabledTotpDisabledConfig ,
13571358 passwordPolicyConfig : passwordConfig ,
1358- recaptchaConfig : expectedRecaptchaConfig2 ,
1359+ recaptchaConfig : expectedRecaptchaOffConfig ,
13591360 emailPrivacyConfig : { } ,
13601361 } ;
13611362
@@ -1376,20 +1377,23 @@ describe('admin.auth', () => {
13761377 . then ( ( actualProjectConfig ) => {
13771378 // Existing keys won't be deleted from the response and generated differently each time.
13781379 delete actualProjectConfig . recaptchaConfig ?. recaptchaKeys ;
1380+ // response from backend ignores account defender status when recaptcha status is OFF.
1381+ delete expectedProjectConfigSmsEnabledTotpDisabled . recaptchaConfig ?. useAccountDefender ;
13791382 expect ( actualProjectConfig . toJSON ( ) ) . to . deep . equal ( expectedProjectConfigSmsEnabledTotpDisabled ) ;
13801383 } ) ;
13811384 } ) ;
13821385
13831386 it ( 'getProjectConfig() should resolve with expected project config' , ( ) => {
13841387 return getAuth ( ) . projectConfigManager ( ) . getProjectConfig ( )
13851388 . then ( ( actualConfig ) => {
1389+ delete actualConfig . recaptchaConfig ?. recaptchaKeys ;
13861390 const actualConfigObj = actualConfig . toJSON ( ) ;
13871391 expect ( actualConfigObj ) . to . deep . equal ( expectedProjectConfigSmsEnabledTotpDisabled ) ;
13881392 } ) ;
13891393 } ) ;
13901394 } ) ;
13911395
1392- describe ( 'Tenant management operations' , ( ) => {
1396+ describe . only ( 'Tenant management operations' , ( ) => {
13931397 let createdTenantId : string ;
13941398 const createdTenants : string [ ] = [ ] ;
13951399 const mfaSmsEnabledTotpEnabledConfig : MultiFactorConfig = {
@@ -1508,6 +1512,25 @@ describe('admin.auth', () => {
15081512 recaptchaConfig : recaptchaStateAuditConfig ,
15091513 emailPrivacyConfig : { } ,
15101514 } ;
1515+ const expectedTenantRecaptchaOffConfig : any = {
1516+ emailPasswordEnforcementState : 'OFF' ,
1517+ phoneEnforcementState : 'OFF' ,
1518+ managedRules : [
1519+ {
1520+ endScore : 0.1 ,
1521+ action : 'BLOCK' ,
1522+ } ,
1523+ ] ,
1524+ smsTollFraudManagedRules : [
1525+ {
1526+ startScore : 0.1 ,
1527+ action : 'BLOCK' ,
1528+ }
1529+ ] ,
1530+ useAccountDefender : false ,
1531+ useSmsBotScore : false ,
1532+ useSmsTollFraudProtection : false ,
1533+ } ;
15111534 const expectedUpdatedTenant2 : any = {
15121535 displayName : 'testTenantUpdated' ,
15131536 emailSignInConfig : {
@@ -1984,9 +2007,8 @@ describe('admin.auth', () => {
19842007 return getAuth ( ) . tenantManager ( ) . updateTenant ( createdTenantId , updatedOptions2 ) ;
19852008 } )
19862009 . then ( ( actualTenant ) => {
1987- // response from backend ignores account defender status is recaptcha status is OFF.
19882010 const expectedUpdatedTenantCopy = deepCopy ( expectedUpdatedTenant2 ) ;
1989- delete expectedUpdatedTenantCopy . recaptchaConfig . useAccountDefender ;
2011+ expectedUpdatedTenantCopy . recaptchaConfig = deepCopy ( expectedTenantRecaptchaOffConfig ) ;
19902012 expect ( actualTenant . toJSON ( ) ) . to . deep . equal ( expectedUpdatedTenantCopy ) ;
19912013 } ) ;
19922014 } ) ;
@@ -2011,6 +2033,7 @@ describe('admin.auth', () => {
20112033 . then ( ( actualTenant ) => {
20122034 // response from backend ignores account defender status is recaptcha status is OFF.
20132035 const expectedUpdatedTenantCopy = deepCopy ( expectedUpdatedTenant2 ) ;
2036+ expectedUpdatedTenantCopy . recaptchaConfig = deepCopy ( expectedTenantRecaptchaOffConfig ) ;
20142037 delete expectedUpdatedTenantCopy . recaptchaConfig . useAccountDefender ;
20152038 expect ( actualTenant . toJSON ( ) ) . to . deep . equal ( expectedUpdatedTenantCopy ) ;
20162039 } ) ;
@@ -2055,6 +2078,7 @@ describe('admin.auth', () => {
20552078 . then ( ( actualTenant ) => {
20562079 // response from backend ignores account defender status is recaptcha status is OFF.
20572080 const expectedUpdatedTenantCopy = deepCopy ( expectedUpdatedTenant2 ) ;
2081+ expectedUpdatedTenantCopy . recaptchaConfig = deepCopy ( expectedTenantRecaptchaOffConfig ) ;
20582082 delete expectedUpdatedTenantCopy . recaptchaConfig . useAccountDefender ;
20592083 expect ( actualTenant . toJSON ( ) ) . to . deep . equal ( expectedUpdatedTenantCopy ) ;
20602084 } ) ;
@@ -2088,6 +2112,7 @@ describe('admin.auth', () => {
20882112 . then ( ( actualTenant ) => {
20892113 // response from backend ignores account defender status is recaptcha status is OFF.
20902114 const expectedUpdatedTenantCopy = deepCopy ( expectedUpdatedTenantSmsEnabledTotpDisabled ) ;
2115+ expectedUpdatedTenantCopy . recaptchaConfig = deepCopy ( expectedTenantRecaptchaOffConfig ) ;
20912116 delete expectedUpdatedTenantCopy . recaptchaConfig . useAccountDefender ;
20922117 expect ( actualTenant . toJSON ( ) ) . to . deep . equal ( expectedUpdatedTenantCopy ) ;
20932118 } ) ;
0 commit comments