Skip to content

Commit 80496e0

Browse files
committed
PR feeback
1 parent 41cc751 commit 80496e0

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

packages-exp/auth-compat-exp/src/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ export class Auth implements compat.FirebaseAuth, Wrapper<externs.Auth> {
8282
signOut(): Promise<void> {
8383
return this.auth.signOut();
8484
}
85-
useEmulator(host: string): void {
86-
this.auth.useEmulator(host);
85+
useEmulator(url: string): void {
86+
this.auth.useEmulator(url);
8787
}
8888
applyActionCode(code: string): Promise<void> {
8989
return impl.applyActionCode(this.auth, code);

packages-exp/auth-exp/src/api/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ describe('api/_performApiRequest', () => {
358358

359359
it('works properly with an emulated environment', () => {
360360
(auth.config as ConfigInternal).emulator = {
361-
host: 'http://localhost:5000'
361+
url: 'http://localhost:5000'
362362
};
363363
expect(_getFinalTarget(auth, 'host', '/path', 'query=test')).to.eq(
364364
'http://localhost:5000/host/path?query=test'

packages-exp/auth-exp/src/core/auth/auth_impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ export class AuthImpl implements Auth, _FirebaseService {
179179
this.languageCode = _getUserLanguage();
180180
}
181181

182-
useEmulator(host: string): void {
182+
useEmulator(url: string): void {
183183
assert(this._canInitEmulator, AuthErrorCode.EMULATOR_CONFIG_FAILED, {
184184
appName: this.name
185185
});
186186

187-
this.config.emulator = { host };
187+
this.config.emulator = { url };
188188
this.settings.appVerificationDisabledForTesting = true;
189189
}
190190

packages-exp/auth-exp/src/core/util/emulator.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ import { _emulatorUrl } from './emulator';
2323
describe('core/util/emulator', () => {
2424
const config: ConfigInternal = {
2525
emulator: {
26-
host: 'http://localhost:4000'
26+
url: 'http://localhost:4000'
2727
}
2828
} as ConfigInternal;
2929

3030
it('builds the proper URL with no path', () => {
31-
expect(_emulatorUrl(config)).to.eq('http://localhost:4000');
31+
expect(_emulatorUrl(config)).to.eq('http://localhost:4000/');
3232
});
3333

3434
it('builds the proper URL with a path', () => {

packages-exp/auth-exp/src/core/util/emulator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import { debugAssert } from './assert';
2020

2121
export function _emulatorUrl(config: ConfigInternal, path?: string): string {
2222
debugAssert(config.emulator, 'Emulator should always be set here');
23-
const { host: emulatorHost } = config.emulator;
23+
const { url } = config.emulator;
24+
const emulatorHost = new URL(url).toString();
2425

2526
if (!path) {
2627
return emulatorHost;
2728
}
2829

29-
const sep = path.startsWith('/') ? '' : '/';
30-
return `${emulatorHost}${sep}${path}`;
30+
return `${emulatorHost}${path.startsWith('/') ? path.slice(1) : path}`;
3131
}

packages-exp/auth-exp/src/model/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type AuthDomain = string;
2626

2727
export interface ConfigInternal extends externs.Config {
2828
emulator?: {
29-
host: string;
29+
url: string;
3030
};
3131
}
3232

packages-exp/auth-types-exp/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export interface Auth {
137137
readonly currentUser: User | null;
138138
updateCurrentUser(user: User | null): Promise<void>;
139139
useDeviceLanguage(): void;
140-
useEmulator(host: string): void;
140+
useEmulator(url: string): void;
141141
signOut(): Promise<void>;
142142
}
143143

0 commit comments

Comments
 (0)