Skip to content

Commit 9dc95f2

Browse files
committed
Formatting
1 parent 895e887 commit 9dc95f2

15 files changed

+171
-58
lines changed

packages-exp/auth-exp/src/core/providers/phone.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,20 @@ export class PhoneAuthProvider implements externs.PhoneAuthProvider {
6565
userCredential: externs.UserCredential
6666
): externs.AuthCredential | null {
6767
const credential = userCredential as UserCredential;
68-
assert(credential._tokenResponse, credential.user.auth.name, AuthErrorCode.ARGUMENT_ERROR);
68+
assert(
69+
credential._tokenResponse,
70+
credential.user.auth.name,
71+
AuthErrorCode.ARGUMENT_ERROR
72+
);
6973
const {
7074
phoneNumber,
7175
temporaryProof
7276
} = credential._tokenResponse as SignInWithPhoneNumberResponse;
7377
if (phoneNumber && temporaryProof) {
74-
return PhoneAuthCredential._fromTokenResponse(phoneNumber, temporaryProof);
78+
return PhoneAuthCredential._fromTokenResponse(
79+
phoneNumber,
80+
temporaryProof
81+
);
7582
}
7683

7784
fail(credential.user.auth.name, AuthErrorCode.ARGUMENT_ERROR);

packages-exp/auth-exp/src/core/strategies/abstract_popup_redirect_operation.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ import { testAuth, testUser } from '../../../test/helpers/mock_auth';
3030
import { makeMockPopupRedirectResolver } from '../../../test/helpers/mock_popup_redirect_resolver';
3131
import { Auth } from '../../model/auth';
3232
import {
33-
AuthEvent, AuthEventType, EventManager, PopupRedirectResolver
33+
AuthEvent,
34+
AuthEventType,
35+
EventManager,
36+
PopupRedirectResolver
3437
} from '../../model/popup_redirect';
3538
import { AuthEventManager } from '../auth/auth_event_manager';
3639
import { AUTH_ERROR_FACTORY, AuthErrorCode } from '../errors';
@@ -86,7 +89,7 @@ describe('src/core/strategies/abstract_popup_redirect_operation', () => {
8689
new UserCredentialImpl(
8790
testUser(auth, 'uid'),
8891
ProviderId.GOOGLE,
89-
{...TEST_ID_TOKEN_RESPONSE},
92+
{ ...TEST_ID_TOKEN_RESPONSE },
9093
OperationType.SIGN_IN
9194
)
9295
)

packages-exp/auth-exp/src/core/strategies/anonymous.test.ts

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

1818
import { expect } from 'chai';
1919

20-
import { OperationType, ProviderId, SignInMethod } from '@firebase/auth-types-exp';
20+
import {
21+
OperationType,
22+
ProviderId,
23+
SignInMethod
24+
} from '@firebase/auth-types-exp';
2125

2226
import { mockEndpoint } from '../../../test/helpers/api/helper';
2327
import { testAuth, testUser } from '../../../test/helpers/mock_auth';
@@ -61,9 +65,7 @@ describe('core/strategies/anonymous', () => {
6165
const userCredential = await signInAnonymously(auth);
6266
expect(userCredential.user.isAnonymous).to.be.true;
6367

64-
const { user, operationType } = await signInAnonymously(
65-
auth
66-
);
68+
const { user, operationType } = await signInAnonymously(auth);
6769
expect(operationType).to.eq(OperationType.SIGN_IN);
6870
expect(user.uid).to.eq(userCredential.user.uid);
6971
expect(user.isAnonymous).to.be.true;
@@ -76,9 +78,7 @@ describe('core/strategies/anonymous', () => {
7678
await auth.updateCurrentUser(fakeUser);
7779
expect(fakeUser.isAnonymous).to.be.false;
7880

79-
const { user, operationType } = await signInAnonymously(
80-
auth
81-
);
81+
const { user, operationType } = await signInAnonymously(auth);
8282
expect(operationType).to.eq(OperationType.SIGN_IN);
8383
expect(user.uid).to.not.eq(fakeUser.uid);
8484
expect(user.isAnonymous).to.be.true;

packages-exp/auth-exp/src/core/strategies/credential.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ import { expect, use } from 'chai';
1919
import * as chaiAsPromised from 'chai-as-promised';
2020
import { stub } from 'sinon';
2121

22-
import { OperationType, ProviderId, SignInMethod } from '@firebase/auth-types-exp';
22+
import {
23+
OperationType,
24+
ProviderId,
25+
SignInMethod
26+
} from '@firebase/auth-types-exp';
2327
import { FirebaseError } from '@firebase/util';
2428

2529
import { mockEndpoint } from '../../../test/helpers/api/helper';
@@ -37,7 +41,9 @@ import { User, UserCredential } from '../../model/user';
3741
import { AuthCredential } from '../credentials';
3842
import { AUTH_ERROR_FACTORY, AuthErrorCode } from '../errors';
3943
import {
40-
linkWithCredential, reauthenticateWithCredential, signInWithCredential
44+
linkWithCredential,
45+
reauthenticateWithCredential,
46+
signInWithCredential
4147
} from './credential';
4248

4349
use(chaiAsPromised);

packages-exp/auth-exp/src/core/strategies/custom_token.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,14 @@ describe('core/strategies/signInWithCustomToken', () => {
6666
afterEach(mockFetch.tearDown);
6767

6868
it('should return a valid user credential', async () => {
69-
const { user, operationType, _tokenResponse } = await signInWithCustomToken(
69+
const {
70+
user,
71+
operationType,
72+
_tokenResponse
73+
} = (await signInWithCustomToken(
7074
auth,
7175
'look-at-me-im-a-jwt'
72-
) as UserCredential;
76+
)) as UserCredential;
7377
expect(_tokenResponse).to.eql(idTokenResponse);
7478
expect(user.uid).to.eq('local-id');
7579
expect(user.tenantId).to.eq('tenant-id');

packages-exp/auth-exp/src/core/strategies/email_and_password.test.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ import { expect, use } from 'chai';
1919
import * as chaiAsPromised from 'chai-as-promised';
2020
import * as sinonChai from 'sinon-chai';
2121

22-
import { Operation, OperationType, ProviderId, SignInMethod } from '@firebase/auth-types-exp';
22+
import {
23+
Operation,
24+
OperationType,
25+
ProviderId,
26+
SignInMethod
27+
} from '@firebase/auth-types-exp';
2328
import { FirebaseError } from '@firebase/util';
2429

2530
import { mockEndpoint } from '../../../test/helpers/api/helper';
@@ -31,8 +36,13 @@ import { ServerError } from '../../api/errors';
3136
import { Auth } from '../../model/auth';
3237
import { UserCredential } from '../../model/user';
3338
import {
34-
applyActionCode, checkActionCode, confirmPasswordReset, createUserWithEmailAndPassword,
35-
sendPasswordResetEmail, signInWithEmailAndPassword, verifyPasswordResetCode
39+
applyActionCode,
40+
checkActionCode,
41+
confirmPasswordReset,
42+
createUserWithEmailAndPassword,
43+
sendPasswordResetEmail,
44+
signInWithEmailAndPassword,
45+
verifyPasswordResetCode
3646
} from './email_and_password';
3747

3848
use(chaiAsPromised);
@@ -385,11 +395,11 @@ describe('core/strategies/email_and_password/createUserWithEmailAndPassword', ()
385395
_tokenResponse,
386396
user,
387397
operationType
388-
} = await createUserWithEmailAndPassword(
398+
} = (await createUserWithEmailAndPassword(
389399
auth,
390400
'some-email',
391401
'some-password'
392-
) as UserCredential;
402+
)) as UserCredential;
393403
expect(_tokenResponse).to.eql({
394404
idToken: 'id-token',
395405
refreshToken: 'refresh-token',
@@ -428,7 +438,11 @@ describe('core/strategies/email_and_password/signInWithEmailAndPassword', () =>
428438
_tokenResponse,
429439
user,
430440
operationType
431-
} = await signInWithEmailAndPassword(auth, 'some-email', 'some-password') as UserCredential;
441+
} = (await signInWithEmailAndPassword(
442+
auth,
443+
'some-email',
444+
'some-password'
445+
)) as UserCredential;
432446
expect(_tokenResponse).to.eql({
433447
idToken: 'id-token',
434448
refreshToken: 'refresh-token',

packages-exp/auth-exp/src/core/strategies/email_link.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import * as chaiAsPromised from 'chai-as-promised';
2020
import * as sinonChai from 'sinon-chai';
2121

2222
import * as externs from '@firebase/auth-types-exp';
23-
import { OperationType, ProviderId, SignInMethod } from '@firebase/auth-types-exp';
23+
import {
24+
OperationType,
25+
ProviderId,
26+
SignInMethod
27+
} from '@firebase/auth-types-exp';
2428
import { FirebaseError } from '@firebase/util';
2529

2630
import { mockEndpoint } from '../../../test/helpers/api/helper';
@@ -31,7 +35,11 @@ import { APIUserInfo } from '../../api/account_management/account';
3135
import { ServerError } from '../../api/errors';
3236
import { Auth } from '../../model/auth';
3337
import { UserCredential } from '../../model/user';
34-
import { isSignInWithEmailLink, sendSignInLinkToEmail, signInWithEmailLink } from './email_link';
38+
import {
39+
isSignInWithEmailLink,
40+
sendSignInLinkToEmail,
41+
signInWithEmailLink
42+
} from './email_link';
3543

3644
use(chaiAsPromised);
3745
use(sinonChai);
@@ -226,11 +234,11 @@ describe('core/strategies/email_and_password/signInWithEmailLink', () => {
226234
'continueUrl=' +
227235
encodeURIComponent(continueUrl) +
228236
'&languageCode=en&state=bla';
229-
const { _tokenResponse, user, operationType } = await signInWithEmailLink(
237+
const { _tokenResponse, user, operationType } = (await signInWithEmailLink(
230238
auth,
231239
'some-email',
232240
actionLink
233-
) as UserCredential;
241+
)) as UserCredential;
234242
expect(_tokenResponse).to.eql({
235243
idToken: 'id-token',
236244
refreshToken: 'refresh-token',

packages-exp/auth-exp/src/core/strategies/popup.test.ts

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import * as chaiAsPromised from 'chai-as-promised';
2020
import * as sinon from 'sinon';
2121
import * as sinonChai from 'sinon-chai';
2222

23-
import { OperationType, PopupRedirectResolver, ProviderId } from '@firebase/auth-types-exp';
23+
import {
24+
OperationType,
25+
PopupRedirectResolver,
26+
ProviderId
27+
} from '@firebase/auth-types-exp';
2428
import { FirebaseError } from '@firebase/util';
2529

2630
import { delay } from '../../../test/helpers/delay';
@@ -39,8 +43,11 @@ import * as eid from '../util/event_id';
3943
import { AuthPopup } from '../util/popup';
4044
import * as idpTasks from './idp';
4145
import {
42-
_AUTH_EVENT_TIMEOUT, _POLL_WINDOW_CLOSE_TIMEOUT, linkWithPopup, reauthenticateWithPopup,
43-
signInWithPopup
46+
_AUTH_EVENT_TIMEOUT,
47+
_POLL_WINDOW_CLOSE_TIMEOUT,
48+
linkWithPopup,
49+
reauthenticateWithPopup,
50+
signInWithPopup
4451
} from './popup';
4552

4653
use(sinonChai);
@@ -244,8 +251,12 @@ describe('src/core/strategies/popup', () => {
244251
});
245252

246253
it('completes the full flow', async () => {
247-
const cred = new UserCredentialImpl(user, ProviderId.GOOGLE,
248-
undefined, OperationType.LINK);
254+
const cred = new UserCredentialImpl(
255+
user,
256+
ProviderId.GOOGLE,
257+
undefined,
258+
OperationType.LINK
259+
);
249260
idpStubs._link.returns(Promise.resolve(cred));
250261
const promise = linkWithPopup(user, provider, resolver);
251262
iframeEvent({
@@ -255,8 +266,12 @@ describe('src/core/strategies/popup', () => {
255266
});
256267

257268
it('ignores events for another event id', async () => {
258-
const cred = new UserCredentialImpl(user, ProviderId.GOOGLE,
259-
undefined, OperationType.LINK);
269+
const cred = new UserCredentialImpl(
270+
user,
271+
ProviderId.GOOGLE,
272+
undefined,
273+
OperationType.LINK
274+
);
260275
idpStubs._link.returns(Promise.resolve(cred));
261276
const promise = linkWithPopup(user, provider, resolver);
262277
iframeEvent({
@@ -277,8 +292,12 @@ describe('src/core/strategies/popup', () => {
277292
});
278293

279294
it('does not call idp tasks if event is error', async () => {
280-
const cred = new UserCredentialImpl(user, ProviderId.GOOGLE,
281-
undefined, OperationType.LINK);
295+
const cred = new UserCredentialImpl(
296+
user,
297+
ProviderId.GOOGLE,
298+
undefined,
299+
OperationType.LINK
300+
);
282301
idpStubs._link.returns(Promise.resolve(cred));
283302
const promise = linkWithPopup(user, provider, resolver);
284303
iframeEvent({
@@ -298,8 +317,12 @@ describe('src/core/strategies/popup', () => {
298317
});
299318

300319
it('does not error if the poll timeout trips', async () => {
301-
const cred = new UserCredentialImpl(user, ProviderId.GOOGLE,
302-
undefined, OperationType.LINK);
320+
const cred = new UserCredentialImpl(
321+
user,
322+
ProviderId.GOOGLE,
323+
undefined,
324+
OperationType.LINK
325+
);
303326
idpStubs._link.returns(Promise.resolve(cred));
304327
const promise = linkWithPopup(user, provider, resolver);
305328
delay(() => {
@@ -313,8 +336,12 @@ describe('src/core/strategies/popup', () => {
313336
});
314337

315338
it('does error if the poll timeout and event timeout trip', async () => {
316-
const cred = new UserCredentialImpl(user, ProviderId.GOOGLE,
317-
undefined, OperationType.LINK);
339+
const cred = new UserCredentialImpl(
340+
user,
341+
ProviderId.GOOGLE,
342+
undefined,
343+
OperationType.LINK
344+
);
318345
idpStubs._link.returns(Promise.resolve(cred));
319346
const promise = linkWithPopup(user, provider, resolver);
320347
delay(() => {
@@ -352,8 +379,12 @@ describe('src/core/strategies/popup', () => {
352379
});
353380

354381
it('cancels the task if called consecutively', async () => {
355-
const cred = new UserCredentialImpl(user, ProviderId.GOOGLE,
356-
undefined, OperationType.LINK);
382+
const cred = new UserCredentialImpl(
383+
user,
384+
ProviderId.GOOGLE,
385+
undefined,
386+
OperationType.LINK
387+
);
357388
idpStubs._link.returns(Promise.resolve(cred));
358389
const firstPromise = linkWithPopup(user, provider, resolver);
359390
const secondPromise = linkWithPopup(user, provider, resolver);

packages-exp/auth-exp/src/core/strategies/redirect.test.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ import * as externs from '@firebase/auth-types-exp';
2525
import { delay } from '../../../test/helpers/delay';
2626
import { BASE_AUTH_EVENT } from '../../../test/helpers/iframe_event';
2727
import {
28-
MockPersistenceLayer, testAuth, TestAuth, testUser
28+
MockPersistenceLayer,
29+
testAuth,
30+
TestAuth,
31+
testUser
2932
} from '../../../test/helpers/mock_auth';
3033
import { makeMockPopupRedirectResolver } from '../../../test/helpers/mock_popup_redirect_resolver';
31-
import { AuthEvent, AuthEventType, PopupRedirectResolver } from '../../model/popup_redirect';
34+
import {
35+
AuthEvent,
36+
AuthEventType,
37+
PopupRedirectResolver
38+
} from '../../model/popup_redirect';
3239
import { User } from '../../model/user';
3340
import { AuthEventManager } from '../auth/auth_event_manager';
3441
import { AuthErrorCode } from '../errors';
@@ -40,8 +47,11 @@ import { UserCredentialImpl } from '../user/user_credential_impl';
4047
import { _getInstance } from '../util/instantiator';
4148
import * as idpTasks from './idp';
4249
import {
43-
_clearOutcomes, getRedirectResult, linkWithRedirect, reauthenticateWithRedirect,
44-
signInWithRedirect
50+
_clearOutcomes,
51+
getRedirectResult,
52+
linkWithRedirect,
53+
reauthenticateWithRedirect,
54+
signInWithRedirect
4555
} from './redirect';
4656

4757
use(sinonChai);

packages-exp/auth-exp/src/core/user/reauthenticate.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ import { expect, use } from 'chai';
1919
import * as chaiAsPromised from 'chai-as-promised';
2020
import { stub } from 'sinon';
2121

22-
import { OperationType, ProviderId, SignInMethod } from '@firebase/auth-types-exp';
22+
import {
23+
OperationType,
24+
ProviderId,
25+
SignInMethod
26+
} from '@firebase/auth-types-exp';
2327
import { FirebaseError } from '@firebase/util';
2428

2529
import { mockEndpoint } from '../../../test/helpers/api/helper';
@@ -170,7 +174,7 @@ describe('src/core/user/reauthenticate', () => {
170174
users: [{ localId: 'uid' }]
171175
});
172176

173-
const cred = await _reauthenticate(user, credential) as UserCredential;
177+
const cred = (await _reauthenticate(user, credential)) as UserCredential;
174178

175179
expect(cred.operationType).to.eq(OperationType.REAUTHENTICATE);
176180
expect(cred._tokenResponse).to.eq(response);

0 commit comments

Comments
 (0)