@@ -1421,7 +1421,7 @@ describe('admin.auth', () => {
14211421
14221422 describe ( 'importUsers()' , ( ) => {
14231423 const randomUid = 'import_' + generateRandomString ( 20 ) . toLowerCase ( ) ;
1424- let importUserRecord : any ;
1424+ let importUserRecord : admin . auth . UserImportRecord ;
14251425 const rawPassword = 'password' ;
14261426 const rawSalt = 'NaCl' ;
14271427 // Simulate a user stored using SCRYPT being migrated to Firebase Auth via importUsers.
@@ -1635,15 +1635,15 @@ describe('admin.auth', () => {
16351635 return admin . auth ( ) . getUser ( uid ) ;
16361636 } ) . then ( ( userRecord ) => {
16371637 // The phone number provider will be appended to the list of accounts.
1638- importUserRecord . providerData . push ( {
1639- uid : importUserRecord . phoneNumber ,
1638+ importUserRecord . providerData ? .push ( {
1639+ uid : importUserRecord . phoneNumber ! ,
16401640 providerId : 'phone' ,
1641- phoneNumber : importUserRecord . phoneNumber ,
1641+ phoneNumber : importUserRecord . phoneNumber ! ,
16421642 } ) ;
16431643 const actualUserRecord : { [ key : string ] : any } = userRecord . toJSON ( ) ;
16441644 for ( const key of Object . keys ( importUserRecord ) ) {
16451645 expect ( JSON . stringify ( actualUserRecord [ key ] ) )
1646- . to . be . equal ( JSON . stringify ( importUserRecord [ key ] ) ) ;
1646+ . to . be . equal ( JSON . stringify ( ( importUserRecord as any ) [ key ] ) ) ;
16471647 }
16481648 } ) . should . eventually . be . fulfilled ;
16491649 } ) ;
@@ -1652,6 +1652,23 @@ describe('admin.auth', () => {
16521652 const uid = generateRandomString ( 20 ) . toLowerCase ( ) ;
16531653 const email = uid + '@example.com' ;
16541654 const now = new Date ( 1476235905000 ) . toUTCString ( ) ;
1655+ const enrolledFactors : admin . auth . UpdatePhoneMultiFactorInfoRequest [ ] = [
1656+ {
1657+ uid : 'mfaUid1' ,
1658+ phoneNumber : '+16505550001' ,
1659+ displayName : 'Work phone number' ,
1660+ factorId : 'phone' ,
1661+ enrollmentTime : now ,
1662+ } ,
1663+ {
1664+ uid : 'mfaUid2' ,
1665+ phoneNumber : '+16505550002' ,
1666+ displayName : 'Personal phone number' ,
1667+ factorId : 'phone' ,
1668+ enrollmentTime : now ,
1669+ } ,
1670+ ] ;
1671+
16551672 importUserRecord = {
16561673 uid,
16571674 email,
@@ -1671,22 +1688,7 @@ describe('admin.auth', () => {
16711688 } ,
16721689 ] ,
16731690 multiFactor : {
1674- enrolledFactors : [
1675- {
1676- uid : 'mfaUid1' ,
1677- phoneNumber : '+16505550001' ,
1678- displayName : 'Work phone number' ,
1679- factorId : 'phone' ,
1680- enrollmentTime : now ,
1681- } ,
1682- {
1683- uid : 'mfaUid2' ,
1684- phoneNumber : '+16505550002' ,
1685- displayName : 'Personal phone number' ,
1686- factorId : 'phone' ,
1687- enrollmentTime : now ,
1688- } ,
1689- ] ,
1691+ enrolledFactors,
16901692 } ,
16911693 } ;
16921694 uids . push ( importUserRecord . uid ) ;
@@ -1702,7 +1704,7 @@ describe('admin.auth', () => {
17021704 const actualUserRecord : { [ key : string ] : any } = userRecord . toJSON ( ) ;
17031705 expect ( actualUserRecord . multiFactor . enrolledFactors . length ) . to . equal ( 2 ) ;
17041706 expect ( actualUserRecord . multiFactor . enrolledFactors )
1705- . to . deep . equal ( importUserRecord . multiFactor . enrolledFactors ) ;
1707+ . to . deep . equal ( importUserRecord . multiFactor ? .enrolledFactors ) ;
17061708 } ) . should . eventually . be . fulfilled ;
17071709 } ) ;
17081710
@@ -1741,7 +1743,9 @@ describe('admin.auth', () => {
17411743 * @retunr {Promise<void>} A promise that resolved on success.
17421744 */
17431745function testImportAndSignInUser (
1744- importUserRecord : any , importOptions : any , rawPassword : string ) : Promise < void > {
1746+ importUserRecord : admin . auth . UserImportRecord ,
1747+ importOptions : any ,
1748+ rawPassword : string ) : Promise < void > {
17451749 const users = [ importUserRecord ] ;
17461750 // Import the user record.
17471751 return admin . auth ( ) . importUsers ( users , importOptions )
@@ -1751,7 +1755,7 @@ function testImportAndSignInUser(
17511755 expect ( result . successCount ) . to . equal ( 1 ) ;
17521756 expect ( result . errors . length ) . to . equal ( 0 ) ;
17531757 // Sign in with an email and password to the imported account.
1754- return clientAuth ( ) . signInWithEmailAndPassword ( users [ 0 ] . email , rawPassword ) ;
1758+ return clientAuth ( ) . signInWithEmailAndPassword ( users [ 0 ] . email ! , rawPassword ) ;
17551759 } )
17561760 . then ( ( { user} ) => {
17571761 // Confirm successful sign-in.
0 commit comments