Skip to content

Commit 2dbe265

Browse files
committed
Formatting
1 parent 04b2d33 commit 2dbe265

File tree

9 files changed

+88
-24
lines changed

9 files changed

+88
-24
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ import * as mockFetch from '../../test/helpers/mock_fetch';
2727
import { AuthErrorCode } from '../core/errors';
2828
import { ConfigInternal } from '../model/auth';
2929
import {
30-
_getFinalTarget, _performApiRequest, DEFAULT_API_TIMEOUT_MS, Endpoint, HttpHeader, HttpMethod
30+
_getFinalTarget,
31+
_performApiRequest,
32+
DEFAULT_API_TIMEOUT_MS,
33+
Endpoint,
34+
HttpHeader,
35+
HttpMethod
3136
} from './';
3237
import { ServerError } from './errors';
3338

@@ -327,15 +332,19 @@ describe('api/_performApiRequest', () => {
327332

328333
context('_getFinalTarget', () => {
329334
it('works properly with a non-emulated environment', () => {
330-
expect(_getFinalTarget(auth, 'host', '/path', 'query=test')).to.eq('mock://host/path?query=test');
335+
expect(_getFinalTarget(auth, 'host', '/path', 'query=test')).to.eq(
336+
'mock://host/path?query=test'
337+
);
331338
});
332339

333340
it('works properly with an emulated environment', () => {
334341
(auth.config as ConfigInternal).emulator = {
335342
hostname: 'localhost',
336-
port: 5000,
343+
port: 5000
337344
};
338-
expect(_getFinalTarget(auth, 'host', '/path', 'query=test')).to.eq('http://localhost:5000/host/path?query=test');
345+
expect(_getFinalTarget(auth, 'host', '/path', 'query=test')).to.eq(
346+
'http://localhost:5000/host/path?query=test'
347+
);
339348
});
340349
});
341350
});

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818
import { FirebaseError, querystring } from '@firebase/util';
1919

20-
import { AUTH_ERROR_FACTORY, AuthErrorCode, NamedErrorParams } from '../core/errors';
20+
import {
21+
AUTH_ERROR_FACTORY,
22+
AuthErrorCode,
23+
NamedErrorParams
24+
} from '../core/errors';
2125
import { fail } from '../core/util/assert';
2226
import { Delay } from '../core/util/delay';
2327
import { _emulatorUrl } from '../core/util/emulator';

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ import { inMemoryPersistence } from '../persistence/in_memory';
3434
import { _getInstance } from '../util/instantiator';
3535
import * as navigator from '../util/navigator';
3636
import {
37-
_castAuth, AuthImpl, DEFAULT_API_HOST, DEFAULT_API_SCHEME, DEFAULT_TOKEN_API_HOST
37+
_castAuth,
38+
AuthImpl,
39+
DEFAULT_API_HOST,
40+
DEFAULT_API_SCHEME,
41+
DEFAULT_TOKEN_API_HOST
3842
} from './auth_impl';
3943
import { _initializeAuthInstance } from './initialize';
4044

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
import { _FirebaseService, FirebaseApp } from '@firebase/app-types-exp';
1919
import * as externs from '@firebase/auth-types-exp';
2020
import {
21-
CompleteFn, createSubscribe, ErrorFn, NextFn, Observer, Subscribe, Unsubscribe
21+
CompleteFn,
22+
createSubscribe,
23+
ErrorFn,
24+
NextFn,
25+
Observer,
26+
Subscribe,
27+
Unsubscribe
2228
} from '@firebase/util';
2329

2430
import { Auth, AuthCore, ConfigInternal } from '../../model/auth';
@@ -27,7 +33,8 @@ import { User, UserParameters } from '../../model/user';
2733
import { AuthErrorCode } from '../errors';
2834
import { Persistence } from '../persistence';
2935
import {
30-
_REDIRECT_USER_KEY_NAME, PersistenceUserManager
36+
_REDIRECT_USER_KEY_NAME,
37+
PersistenceUserManager
3138
} from '../persistence/persistence_user_manager';
3239
import { _reloadWithoutSaving } from '../user/reload';
3340
import { UserImpl } from '../user/user_impl';
@@ -182,14 +189,11 @@ export class AuthImplCompat<T extends User> implements Auth, _FirebaseService {
182189
this.languageCode = _getUserLanguage();
183190
}
184191

185-
useEmulator(
186-
hostname: string,
187-
port: number
188-
): void {
192+
useEmulator(hostname: string, port: number): void {
189193
assert(this._canInitEmulator, AuthErrorCode.EMULATOR_CONFIG_FAILED, {
190194
appName: this.name
191195
});
192-
196+
193197
this.config.emulator = {
194198
hostname,
195199
port

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
import { expect } from 'chai';
219

320
import { ConfigInternal } from '../../model/auth';
@@ -16,10 +33,14 @@ describe('core/util/emulator', () => {
1633
});
1734

1835
it('builds the proper URL with a path', () => {
19-
expect(_emulatorUrl(config, '/test/path')).to.eq('http://localhost:4000/test/path');
36+
expect(_emulatorUrl(config, '/test/path')).to.eq(
37+
'http://localhost:4000/test/path'
38+
);
2039
});
2140

2241
it('builds the proper URL with a path missing separator', () => {
23-
expect(_emulatorUrl(config, 'test/path')).to.eq('http://localhost:4000/test/path');
42+
expect(_emulatorUrl(config, 'test/path')).to.eq(
43+
'http://localhost:4000/test/path'
44+
);
2445
});
25-
});
46+
});
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
import { ConfigInternal } from '../../model/auth';
219
import { debugAssert } from './assert';
320

421
export function _emulatorUrl(config: ConfigInternal, path?: string): string {
522
debugAssert(config.emulator, 'Emulator should always be set here');
6-
const {hostname, port} = config.emulator;
23+
const { hostname, port } = config.emulator;
724

825
const base = `http://${hostname}:${port}`;
926
if (!path) {
@@ -12,4 +29,4 @@ export function _emulatorUrl(config: ConfigInternal, path?: string): string {
1229

1330
const sep = path.startsWith('/') ? '' : '/';
1431
return `${base}${sep}${path}`;
15-
}
32+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function _validateOrigin(auth: Auth): Promise<void> {
2929
if (auth.config.emulator) {
3030
return;
3131
}
32-
32+
3333
const { authorizedDomains } = await _getProjectConfig(auth);
3434

3535
for (const domain of authorizedDomains) {

packages-exp/auth-exp/src/platform_browser/iframe/iframe.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ const IFRAME_ATTRIBUTES = {
4141

4242
function getIframeUrl(auth: AuthCore): string {
4343
const config = auth.config;
44-
const url = config.emulator ? _emulatorUrl(config, EMULATED_IFRAME_PATH) :
45-
`https://${auth.config.authDomain!}/${IFRAME_PATH}`;
44+
const url = config.emulator
45+
? _emulatorUrl(config, EMULATED_IFRAME_PATH)
46+
: `https://${auth.config.authDomain!}/${IFRAME_PATH}`;
4647

4748
const params = {
4849
apiKey: config.apiKey,

packages-exp/auth-exp/src/platform_browser/popup_redirect.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ import { _getCurrentUrl } from '../core/util/location';
2929
import { _validateOrigin } from '../core/util/validate_origin';
3030
import { ApiKey, AppName, Auth } from '../model/auth';
3131
import {
32-
AuthEventType, EventManager, GapiAuthEvent, GapiOutcome, PopupRedirectResolver
32+
AuthEventType,
33+
EventManager,
34+
GapiAuthEvent,
35+
GapiOutcome,
36+
PopupRedirectResolver
3337
} from '../model/popup_redirect';
3438
import { _setWindowLocation } from './auth_window';
3539
import { _openIframe } from './iframe/iframe';
@@ -208,10 +212,10 @@ function getRedirectUrl(
208212
return url.toString();
209213
}
210214

211-
function getHandlerBase({config}: Auth): string {
215+
function getHandlerBase({ config }: Auth): string {
212216
if (!config.emulator) {
213217
return `https://${config.authDomain}/${WIDGET_PATH}`;
214218
}
215219

216220
return _emulatorUrl(config, EMULATOR_WIDGET_PATH);
217-
}
221+
}

0 commit comments

Comments
 (0)