Skip to content

Commit 83173d5

Browse files
committed
Formatting
1 parent 19483c5 commit 83173d5

14 files changed

+170
-93
lines changed

packages-exp/auth-exp/src/core/credentials/from_token_response.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { ProviderId } from '@firebase/auth-types-exp';
2222
import { TEST_ID_TOKEN_RESPONSE } from '../../../test/id_token_response';
2323
import { _authCredentialFromTokenResponse } from './from_token_response';
2424

25-
describe('src/core/credentials/inferred', () => {
25+
describe('src/core/credentials/inferred', () => {
2626
it('returns a phone credential if response conains correct fields', () => {
2727
const cred = _authCredentialFromTokenResponse({
2828
...TEST_ID_TOKEN_RESPONSE,
@@ -35,9 +35,9 @@ import { _authCredentialFromTokenResponse } from './from_token_response';
3535

3636
it('returns null if nothing matches', () => {
3737
const cred = _authCredentialFromTokenResponse({
38-
...TEST_ID_TOKEN_RESPONSE,
38+
...TEST_ID_TOKEN_RESPONSE
3939
});
4040

4141
expect(cred).to.be.null;
4242
});
43-
});
43+
});

packages-exp/auth-exp/src/core/credentials/from_token_response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ export function _authCredentialFromTokenResponse(
3333

3434
// TODO: Handle Oauth cases
3535
return null;
36-
}
36+
}

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

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

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

2428
import { mockEndpoint } from '../../../test/api/helper';
@@ -32,7 +36,9 @@ import { Auth } from '../../model/auth';
3236
import { IdTokenResponse } from '../../model/id_token';
3337
import { User } from '../../model/user';
3438
import {
35-
linkWithCredential, reauthenticateWithCredential, signInWithCredential
39+
linkWithCredential,
40+
reauthenticateWithCredential,
41+
signInWithCredential
3642
} from './credential';
3743

3844
use(chaiAsPromised);

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ export async function linkWithCredential(
5454

5555
await _assertLinkedStatus(false, user, credential.providerId);
5656

57-
return _link(user, credential._linkToIdToken(
58-
user.auth,
59-
await user.getIdToken(),
60-
));
57+
return _link(
58+
user,
59+
credential._linkToIdToken(user.auth, await user.getIdToken())
60+
);
6161
}
6262

6363
export async function reauthenticateWithCredential(
@@ -67,6 +67,8 @@ export async function reauthenticateWithCredential(
6767
const credential = credentialExtern as AuthCredential;
6868
const user = userExtern as User;
6969

70-
return _reauthenticate(user, credential._getReauthenticationResolver(user.auth));
70+
return _reauthenticate(
71+
user,
72+
credential._getReauthenticationResolver(user.auth)
73+
);
7174
}
72-

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

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2019 Google Inc.
3+
* Copyright 2019 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
1918
import { expect, use } from 'chai';
2019
import * as chaiAsPromised from 'chai-as-promised';
2120

@@ -45,14 +44,12 @@ describe('src/core/strategies/idb', () => {
4544
fetch.setUp();
4645

4746
mockEndpoint(Endpoint.GET_ACCOUNT_INFO, {
48-
users: [
49-
{localId: 'uid'}
50-
]
47+
users: [{ localId: 'uid' }]
5148
});
5249

5350
signInEndpoint = mockEndpoint(Endpoint.SIGN_IN_WITH_IDP, {
5451
...TEST_ID_TOKEN_RESPONSE,
55-
idToken: makeJWT({sub: 'uid'})
52+
idToken: makeJWT({ sub: 'uid' })
5653
});
5754
});
5855

@@ -68,7 +65,7 @@ describe('src/core/strategies/idb', () => {
6865
sessionId: 'session-id',
6966
tenantId: 'tenant-id',
7067
pendingToken: 'pending-token',
71-
postBody: 'post-body',
68+
postBody: 'post-body'
7269
});
7370

7471
expect(signInEndpoint.calls[0].request).to.eql({
@@ -77,18 +74,18 @@ describe('src/core/strategies/idb', () => {
7774
postBody: 'post-body',
7875
tenantId: 'tenant-id',
7976
pendingToken: 'pending-token',
80-
returnSecureToken: true,
77+
returnSecureToken: true
8178
});
8279
});
8380

8481
it('returns a user credential with the signed in user', async () => {
85-
const userCred= await idpTasks._signIn({
82+
const userCred = await idpTasks._signIn({
8683
auth,
8784
requestUri: 'request-uri',
8885
sessionId: 'session-id',
8986
tenantId: 'tenant-id',
9087
pendingToken: 'pending-token',
91-
postBody: 'post-body',
88+
postBody: 'post-body'
9289
});
9390

9491
expect(userCred.operationType).to.eq(OperationType.SIGN_IN);
@@ -105,7 +102,7 @@ describe('src/core/strategies/idb', () => {
105102
sessionId: 'session-id',
106103
tenantId: 'tenant-id',
107104
pendingToken: 'pending-token',
108-
postBody: 'post-body',
105+
postBody: 'post-body'
109106
});
110107

111108
expect(signInEndpoint.calls[0].request).to.eql({
@@ -114,19 +111,19 @@ describe('src/core/strategies/idb', () => {
114111
postBody: 'post-body',
115112
tenantId: 'tenant-id',
116113
pendingToken: 'pending-token',
117-
returnSecureToken: true,
114+
returnSecureToken: true
118115
});
119116
});
120117

121118
it('returns a user credential with the reauthed in user', async () => {
122-
const userCred= await idpTasks._reauth({
119+
const userCred = await idpTasks._reauth({
123120
auth,
124121
user,
125122
requestUri: 'request-uri',
126123
sessionId: 'session-id',
127124
tenantId: 'tenant-id',
128125
pendingToken: 'pending-token',
129-
postBody: 'post-body',
126+
postBody: 'post-body'
130127
});
131128

132129
expect(userCred.operationType).to.eq(OperationType.REAUTHENTICATE);
@@ -144,7 +141,7 @@ describe('src/core/strategies/idb', () => {
144141
sessionId: 'session-id',
145142
tenantId: 'tenant-id',
146143
pendingToken: 'pending-token',
147-
postBody: 'post-body',
144+
postBody: 'post-body'
148145
});
149146

150147
expect(signInEndpoint.calls[0].request).to.eql({
@@ -154,23 +151,23 @@ describe('src/core/strategies/idb', () => {
154151
tenantId: 'tenant-id',
155152
pendingToken: 'pending-token',
156153
returnSecureToken: true,
157-
idToken: idTokenBeforeLink,
154+
idToken: idTokenBeforeLink
158155
});
159156
});
160157

161158
it('returns a user credential with the reauthed in user', async () => {
162-
const userCred= await idpTasks._link({
159+
const userCred = await idpTasks._link({
163160
auth,
164161
user,
165162
requestUri: 'request-uri',
166163
sessionId: 'session-id',
167164
tenantId: 'tenant-id',
168165
pendingToken: 'pending-token',
169-
postBody: 'post-body',
166+
postBody: 'post-body'
170167
});
171168

172169
expect(userCred.operationType).to.eq(OperationType.LINK);
173170
expect(userCred.user.uid).to.eq('uid');
174171
});
175172
});
176-
});
173+
});

packages-exp/auth-exp/src/core/strategies/idp.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2019 Google Inc.
3+
* Copyright 2019 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -18,7 +18,9 @@
1818
import { OperationType } from '@firebase/auth-types-exp';
1919

2020
import {
21-
signInWithIdp, SignInWithIdpRequest, SignInWithIdpResponse
21+
signInWithIdp,
22+
SignInWithIdpRequest,
23+
SignInWithIdpResponse
2224
} from '../../api/authentication/idp';
2325
import { Auth } from '../../model/auth';
2426
import { User, UserCredential } from '../../model/user';
@@ -42,13 +44,15 @@ export type IdpTask = (params: IdpTaskParams) => Promise<UserCredential>;
4244

4345
function callIdpSignIn(
4446
{
45-
auth,
46-
requestUri,
47-
sessionId,
48-
tenantId,
49-
pendingToken,
50-
postBody
51-
}: IdpTaskParams, idToken?: string): Promise<SignInWithIdpResponse> {
47+
auth,
48+
requestUri,
49+
sessionId,
50+
tenantId,
51+
pendingToken,
52+
postBody
53+
}: IdpTaskParams,
54+
idToken?: string
55+
): Promise<SignInWithIdpResponse> {
5256
const request: SignInWithIdpRequest = {
5357
requestUri,
5458
sessionId,

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ import { AuthErrorCode } from '../errors';
2727
import { _assertLinkedStatus } from '../user/link_unlink';
2828
import { assert } from '../util/assert';
2929
import {
30-
linkWithCredential, reauthenticateWithCredential, signInWithCredential
30+
linkWithCredential,
31+
reauthenticateWithCredential,
32+
signInWithCredential
3133
} from './credential';
3234

3335
interface OnConfirmationCallback {

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ describe('core/user/link_unlink', () => {
116116
}
117117
]);
118118

119-
expect(auth.persistenceLayer.lastObjectSet).to.eql(user.toPlainObject());
119+
expect(auth.persistenceLayer.lastObjectSet).to.eql(
120+
user.toPlainObject()
121+
);
120122
expect(user.phoneNumber).to.be.null;
121123
});
122124

@@ -151,7 +153,9 @@ describe('core/user/link_unlink', () => {
151153
}
152154
]);
153155

154-
expect(auth.persistenceLayer.lastObjectSet).to.eql(user.toPlainObject());
156+
expect(auth.persistenceLayer.lastObjectSet).to.eql(
157+
user.toPlainObject()
158+
);
155159
});
156160

157161
it('calls the endpoint with the provider', async () => {
@@ -176,7 +180,7 @@ describe('core/user/link_unlink', () => {
176180
createdAt: 123,
177181
lastLoginAt: 456
178182
};
179-
183+
180184
beforeEach(() => {
181185
getAccountInfoEndpoint = mockEndpoint(Endpoint.GET_ACCOUNT_INFO, {
182186
users: [

packages-exp/auth-exp/src/core/user/link_unlink.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,15 @@ export async function unlink(
5656
/**
5757
* Internal-only link helper
5858
*/
59-
export async function _link(user: User, linkAction: Promise<IdTokenResponse>): Promise<UserCredentialImpl> {
60-
return UserCredentialImpl._forOperation(user, externs.OperationType.LINK, await linkAction);
59+
export async function _link(
60+
user: User,
61+
linkAction: Promise<IdTokenResponse>
62+
): Promise<UserCredentialImpl> {
63+
return UserCredentialImpl._forOperation(
64+
user,
65+
externs.OperationType.LINK,
66+
await linkAction
67+
);
6168
}
6269

6370
export async function _assertLinkedStatus(
@@ -73,4 +80,4 @@ export async function _assertLinkedStatus(
7380
? AuthErrorCode.PROVIDER_ALREADY_LINKED
7481
: AuthErrorCode.NO_SUCH_PROVIDER;
7582
assert(providerIds.has(provider) === expected, user.auth.name, code);
76-
}
83+
}

0 commit comments

Comments
 (0)