@@ -1183,10 +1183,9 @@ describe('admin.auth', () => {
1183
1183
state : 'ENABLED' ,
1184
1184
factorIds : [ 'phone' ] ,
1185
1185
} ,
1186
- testPhoneNumbers : {
1187
- '+16505551234' : '019287' ,
1188
- '+16505550676' : '985235' ,
1189
- } ,
1186
+ // Test phone numbers are ignored in auth emulator. For more information,
1187
+ // please refer to this section of the auth emulator DD:
1188
+ // go/firebase-auth-emulator-dd#heading=h.odk06so2ydjd
1190
1189
} ;
1191
1190
const expectedUpdatedTenant : any = {
1192
1191
displayName : 'testTenantUpdated' ,
@@ -1199,9 +1198,10 @@ describe('admin.auth', () => {
1199
1198
state : 'DISABLED' ,
1200
1199
factorIds : [ ] ,
1201
1200
} ,
1202
- testPhoneNumbers : {
1203
- '+16505551234' : '123456' ,
1204
- } ,
1201
+ // Though test phone numbers are ignored in the auth emulator,
1202
+ // non-standard update behavior will still initialize this to an empty
1203
+ // object.
1204
+ testPhoneNumbers : { } ,
1205
1205
} ;
1206
1206
const expectedUpdatedTenant2 : any = {
1207
1207
displayName : 'testTenantUpdated' ,
@@ -1214,6 +1214,10 @@ describe('admin.auth', () => {
1214
1214
state : 'ENABLED' ,
1215
1215
factorIds : [ 'phone' ] ,
1216
1216
} ,
1217
+ // Though test phone numbers are ignored in the auth emulator,
1218
+ // non-standard update behavior will still initialize this to an empty
1219
+ // object.
1220
+ testPhoneNumbers : { } ,
1217
1221
} ;
1218
1222
1219
1223
// https://mochajs.org/
@@ -1490,7 +1494,8 @@ describe('admin.auth', () => {
1490
1494
}
1491
1495
} ) ;
1492
1496
1493
- it ( 'should support CRUD operations' , ( ) => {
1497
+ // TODO(lisajian): Unskip once auth emulator supports OIDC/SAML
1498
+ it . skip ( 'should support CRUD operations' , ( ) => {
1494
1499
return tenantAwareAuth . createProviderConfig ( authProviderConfig )
1495
1500
. then ( ( config ) => {
1496
1501
assertDeepEqualUnordered ( authProviderConfig , config ) ;
@@ -1567,7 +1572,8 @@ describe('admin.auth', () => {
1567
1572
}
1568
1573
} ) ;
1569
1574
1570
- it ( 'should support CRUD operations' , ( ) => {
1575
+ // TODO(lisajian): Unskip once auth emulator supports OIDC/SAML
1576
+ it . skip ( 'should support CRUD operations' , ( ) => {
1571
1577
return tenantAwareAuth . createProviderConfig ( authProviderConfig )
1572
1578
. then ( ( config ) => {
1573
1579
assertDeepEqualUnordered ( authProviderConfig , config ) ;
@@ -1675,15 +1681,28 @@ describe('admin.auth', () => {
1675
1681
} ) ;
1676
1682
1677
1683
it ( 'deleteTenant() should successfully delete the provided tenant' , ( ) => {
1684
+ const allTenantIds : string [ ] = [ ] ;
1685
+ const listAllTenantIds = ( tenantIds : string [ ] , nextPageToken ?: string ) : Promise < void > => {
1686
+ return getAuth ( ) . tenantManager ( ) . listTenants ( 100 , nextPageToken )
1687
+ . then ( ( result ) => {
1688
+ result . tenants . forEach ( ( tenant ) => {
1689
+ tenantIds . push ( tenant . tenantId ) ;
1690
+ } ) ;
1691
+ if ( result . pageToken ) {
1692
+ return listAllTenantIds ( tenantIds , result . pageToken ) ;
1693
+ }
1694
+ } ) ;
1695
+ } ;
1696
+
1678
1697
return getAuth ( ) . tenantManager ( ) . deleteTenant ( createdTenantId )
1679
1698
. then ( ( ) => {
1680
- return getAuth ( ) . tenantManager ( ) . getTenant ( createdTenantId ) ;
1699
+ // Use listTenants() instead of getTenant() to check that the tenant
1700
+ // is no longer present, because Auth Emulator implicitly creates the
1701
+ // tenant in getTenant() when it is not found
1702
+ return listAllTenantIds ( allTenantIds ) ;
1681
1703
} )
1682
1704
. then ( ( ) => {
1683
- throw new Error ( 'unexpected success' ) ;
1684
- } )
1685
- . catch ( ( error ) => {
1686
- expect ( error . code ) . to . equal ( 'auth/tenant-not-found' ) ;
1705
+ expect ( allTenantIds ) . to . not . contain ( createdTenantId ) ;
1687
1706
} ) ;
1688
1707
} ) ;
1689
1708
} ) ;
0 commit comments