@@ -29,6 +29,7 @@ import { Endpoint } from '../../api';
29
29
import { UserInternal } from '../../model/user' ;
30
30
import { _castAuth } from './auth_impl' ;
31
31
import { connectAuthEmulator } from './emulator' ;
32
+ import * as Util from '@firebase/util' ;
32
33
33
34
use ( sinonChai ) ;
34
35
use ( chaiAsPromised ) ;
@@ -38,8 +39,10 @@ describe('core/auth/emulator', () => {
38
39
let user : UserInternal ;
39
40
let normalEndpoint : fetch . Route ;
40
41
let emulatorEndpoint : fetch . Route ;
42
+ let utilStub : sinon . SinonStub ;
41
43
42
44
beforeEach ( async ( ) => {
45
+ utilStub = sinon . stub ( Util , 'pingServer' ) ;
43
46
auth = await testAuth ( ) ;
44
47
user = testUser ( _castAuth ( auth ) , 'uid' , 'email' , true ) ;
45
48
fetch . setUp ( ) ;
@@ -154,6 +157,19 @@ describe('core/auth/emulator', () => {
154
157
) ;
155
158
}
156
159
} ) ;
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
+ } ) ;
157
173
158
174
it ( 'logs out a warning to the console' , ( ) => {
159
175
sinon . stub ( console , 'info' ) ;
0 commit comments