1515 */
1616
1717import * as admin from '../../lib/index' ;
18- import { expect } from 'chai' ;
1918import * as chai from 'chai' ;
2019import * as chaiAsPromised from 'chai-as-promised' ;
2120import firebase = require( 'firebase' ) ;
@@ -25,6 +24,8 @@ import {generateRandomString, projectId, apiKey} from './setup';
2524chai . should ( ) ;
2625chai . use ( chaiAsPromised ) ;
2726
27+ const expect = chai . expect ;
28+
2829const newUserUid = generateRandomString ( 20 ) ;
2930const nonexistentUid = generateRandomString ( 20 ) ;
3031const testPhoneNumber = '+11234567890' ;
@@ -64,7 +65,7 @@ describe('admin.auth', () => {
6465 } ) ;
6566
6667 it ( 'createUser() creates a new user when called without a UID' , ( ) => {
67- let newUserData = clone ( mockUserData ) ;
68+ const newUserData = clone ( mockUserData ) ;
6869 newUserData . email = generateRandomString ( 20 ) + '@example.com' ;
6970 newUserData . phoneNumber = testPhoneNumber2 ;
7071 return admin . auth ( ) . createUser ( newUserData )
@@ -79,7 +80,7 @@ describe('admin.auth', () => {
7980 } ) ;
8081
8182 it ( 'createUser() creates a new user with the specified UID' , ( ) => {
82- let newUserData : any = clone ( mockUserData ) ;
83+ const newUserData : any = clone ( mockUserData ) ;
8384 newUserData . uid = newUserUid ;
8485 return admin . auth ( ) . createUser ( newUserData )
8586 . then ( ( userRecord ) => {
@@ -92,7 +93,7 @@ describe('admin.auth', () => {
9293 } ) ;
9394
9495 it ( 'createUser() fails when the UID is already in use' , ( ) => {
95- let newUserData : any = clone ( mockUserData ) ;
96+ const newUserData : any = clone ( mockUserData ) ;
9697 newUserData . uid = newUserUid ;
9798 return admin . auth ( ) . createUser ( newUserData )
9899 . should . eventually . be . rejected . and . have . property ( 'code' , 'auth/uid-already-exists' ) ;
@@ -120,7 +121,7 @@ describe('admin.auth', () => {
120121 } ) ;
121122
122123 it ( 'listUsers() returns up to the specified number of users' , ( ) => {
123- let promises : Promise < admin . auth . UserRecord > [ ] = [ ] ;
124+ const promises : Array < Promise < admin . auth . UserRecord > > = [ ] ;
124125 uids . forEach ( ( uid ) => {
125126 const tempUserData = {
126127 uid,
@@ -168,7 +169,7 @@ describe('admin.auth', () => {
168169 . then ( ( decodedIdToken ) => {
169170 // Verification should succeed. Revoke that user's session.
170171 return new Promise ( ( resolve ) => setTimeout ( ( ) => resolve (
171- admin . auth ( ) . revokeRefreshTokens ( decodedIdToken . sub )
172+ admin . auth ( ) . revokeRefreshTokens ( decodedIdToken . sub ) ,
172173 ) , 1000 ) ) ;
173174 } )
174175 . then ( ( ) => {
@@ -224,7 +225,7 @@ describe('admin.auth', () => {
224225 } )
225226 . then ( ( decodedIdToken ) => {
226227 // Confirm expected claims set on the user's ID token.
227- for ( let key in customClaims ) {
228+ for ( const key in customClaims ) {
228229 if ( customClaims . hasOwnProperty ( key ) ) {
229230 expect ( decodedIdToken [ key ] ) . to . equal ( customClaims [ key ] ) ;
230231 }
@@ -331,12 +332,12 @@ function deletePhoneNumberUser(phoneNumber) {
331332/**
332333 * Runs cleanup routine that could affect outcome of tests and removes any
333334 * intermediate users created.
334- *
335+ *
335336 * @return {Promise } A promise that resolves when test preparations are ready.
336337 */
337338function cleanup ( ) {
338339 // Delete any existing users that could affect the test outcome.
339- let promises : Promise < void > [ ] = [
340+ const promises : Array < Promise < void > > = [
340341 deletePhoneNumberUser ( testPhoneNumber ) ,
341342 deletePhoneNumberUser ( testPhoneNumber2 ) ,
342343 deletePhoneNumberUser ( nonexistentPhoneNumber ) ,
@@ -351,7 +352,7 @@ function cleanup() {
351352 if ( error . code !== 'auth/user-not-found' ) {
352353 throw error ;
353354 }
354- } )
355+ } ) ,
355356 ) ;
356357 } ) ;
357358 return Promise . all ( promises ) ;
0 commit comments