File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ describe('Auth', function () {
42
42
const bar = auth ( ) . useEmulator ( 'http://127.0.0.1:9099' ) ;
43
43
expect ( bar ) . toEqual ( [ '10.0.2.2' , 9099 ] ) ;
44
44
} ) ;
45
+
46
+ it ( 'useEmulator allows hyphens in the hostname' , function ( ) {
47
+ const result = auth ( ) . useEmulator ( 'http://my-host:9099' ) ;
48
+ expect ( result ) . toEqual ( [ 'my-host' , 9099 ] ) ;
49
+ } ) ;
45
50
} ) ;
46
51
47
52
describe ( 'tenantId' , function ( ) {
Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ class FirebaseAuthModule extends FirebaseModule {
381
381
}
382
382
383
383
// Native calls take the host and port split out
384
- const hostPortRegex = / ^ h t t p : \/ \/ ( [ \w \d . ] + ) : ( \d + ) $ / ;
384
+ const hostPortRegex = / ^ h t t p : \/ \/ ( [ \w \d - . ] + ) : ( \d + ) $ / ;
385
385
const urlMatches = _url . match ( hostPortRegex ) ;
386
386
if ( ! urlMatches ) {
387
387
throw new Error ( 'firebase.auth().useEmulator() unable to parse host and port from URL' ) ;
You can’t perform that action at this time.
0 commit comments