@@ -29,6 +29,7 @@ import { Endpoint } from '../../api';
2929import { UserInternal } from '../../model/user' ;
3030import { _castAuth } from './auth_impl' ;
3131import { connectAuthEmulator } from './emulator' ;
32+ import * as Util from '@firebase/util' ;
3233
3334use ( sinonChai ) ;
3435use ( chaiAsPromised ) ;
@@ -38,8 +39,10 @@ describe('core/auth/emulator', () => {
3839 let user : UserInternal ;
3940 let normalEndpoint : fetch . Route ;
4041 let emulatorEndpoint : fetch . Route ;
42+ let utilStub : sinon . SinonStub ;
4143
4244 beforeEach ( async ( ) => {
45+ utilStub = sinon . stub ( Util , 'pingServer' ) ;
4346 auth = await testAuth ( ) ;
4447 user = testUser ( _castAuth ( auth ) , 'uid' , 'email' , true ) ;
4548 fetch . setUp ( ) ;
@@ -154,6 +157,19 @@ describe('core/auth/emulator', () => {
154157 ) ;
155158 }
156159 } ) ;
160+ it ( 'calls pingServer with port if specified' , ( ) => {
161+ connectAuthEmulator ( auth , 'https://abc.cloudworkstations.dev:2020' ) ;
162+ expect ( utilStub ) . to . have . been . calledWith (
163+ 'https://abc.cloudworkstations.dev:2020'
164+ ) ;
165+ } ) ;
166+
167+ it ( 'calls pingServer with no port if none specified' , ( ) => {
168+ connectAuthEmulator ( auth , 'https://abc.cloudworkstations.dev' ) ;
169+ expect ( utilStub ) . to . have . been . calledWith (
170+ 'https://abc.cloudworkstations.dev'
171+ ) ;
172+ } ) ;
157173
158174 it ( 'logs out a warning to the console' , ( ) => {
159175 sinon . stub ( console , 'info' ) ;
0 commit comments