Skip to content

Commit b8a481e

Browse files
author
Chuan Ren
committed
yarn format
1 parent d72b97c commit b8a481e

21 files changed

+714
-433
lines changed

packages/auth/demo/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ function onSignInAnonymously() {
473473
function onSetTenantID(_event) {
474474
const tenantId = $('#tenant-id').val();
475475
auth.tenantId = tenantId;
476-
if (tenantId === "") {
476+
if (tenantId === '') {
477477
auth.tenantId = null;
478478
}
479479
}

packages/auth/src/api/authentication/email_and_password.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ import chaiAsPromised from 'chai-as-promised';
2121
import { ActionCodeOperation } from '../../model/public_types';
2222
import { FirebaseError } from '@firebase/util';
2323

24-
import { Endpoint, HttpHeader, RecaptchaClientType, RecaptchaVersion } from '../';
24+
import {
25+
Endpoint,
26+
HttpHeader,
27+
RecaptchaClientType,
28+
RecaptchaVersion
29+
} from '../';
2530
import { mockEndpoint } from '../../../test/helpers/api/helper';
2631
import { testAuth, TestAuth } from '../../../test/helpers/mock_auth';
2732
import * as mockFetch from '../../../test/helpers/mock_fetch';
@@ -47,7 +52,7 @@ describe('api/authentication/signInWithPassword', () => {
4752
password: 'my-password',
4853
captchaResponse: 'recaptcha-token',
4954
clientType: RecaptchaClientType.WEB,
50-
recaptchaVersion: RecaptchaVersion.ENTERPRISE,
55+
recaptchaVersion: RecaptchaVersion.ENTERPRISE
5156
};
5257

5358
let auth: TestAuth;
@@ -168,8 +173,8 @@ describe('api/authentication/sendPasswordResetEmail', () => {
168173
169174
captchaResp: 'recaptcha-token',
170175
clientType: RecaptchaClientType.WEB,
171-
recaptchaVersion: RecaptchaVersion.ENTERPRISE,
172-
};
176+
recaptchaVersion: RecaptchaVersion.ENTERPRISE
177+
};
173178

174179
let auth: TestAuth;
175180

@@ -229,7 +234,7 @@ describe('api/authentication/sendSignInLinkToEmail', () => {
229234
230235
captchaResp: 'recaptcha-token',
231236
clientType: RecaptchaClientType.WEB,
232-
recaptchaVersion: RecaptchaVersion.ENTERPRISE,
237+
recaptchaVersion: RecaptchaVersion.ENTERPRISE
233238
};
234239

235240
let auth: TestAuth;

packages/auth/src/api/authentication/recaptcha.test.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@ import chaiAsPromised from 'chai-as-promised';
2020

2121
import { FirebaseError } from '@firebase/util';
2222

23-
import { Endpoint, HttpHeader, RecaptchaClientType, RecaptchaVersion } from '../';
24-
import { mockEndpoint, mockEndpointWithParams } from '../../../test/helpers/api/helper';
23+
import {
24+
Endpoint,
25+
HttpHeader,
26+
RecaptchaClientType,
27+
RecaptchaVersion
28+
} from '../';
29+
import {
30+
mockEndpoint,
31+
mockEndpointWithParams
32+
} from '../../../test/helpers/api/helper';
2533
import { testAuth, TestAuth } from '../../../test/helpers/mock_auth';
2634
import * as mockFetch from '../../../test/helpers/mock_fetch';
2735
import { ServerError } from '../errors';
28-
import { getRecaptchaParams, getRecaptchaConfig, } from './recaptcha';
36+
import { getRecaptchaParams, getRecaptchaConfig } from './recaptcha';
2937

3038
use(chaiAsPromised);
3139

@@ -84,7 +92,7 @@ describe('api/authentication/getRecaptchaParams', () => {
8492
describe('api/authentication/getRecaptchaConfig', () => {
8593
const request = {
8694
clientType: RecaptchaClientType.WEB,
87-
recaptchaVersion: RecaptchaVersion.ENTERPRISE,
95+
recaptchaVersion: RecaptchaVersion.ENTERPRISE
8896
};
8997

9098
let auth: TestAuth;
@@ -97,9 +105,13 @@ describe('api/authentication/getRecaptchaConfig', () => {
97105
afterEach(mockFetch.tearDown);
98106

99107
it('should GET to the correct endpoint', async () => {
100-
const mock = mockEndpointWithParams(Endpoint.GET_RECAPTCHA_CONFIG, request, {
101-
recaptchaKey: 'site-key'
102-
});
108+
const mock = mockEndpointWithParams(
109+
Endpoint.GET_RECAPTCHA_CONFIG,
110+
request,
111+
{
112+
recaptchaKey: 'site-key'
113+
}
114+
);
103115

104116
const response = await getRecaptchaConfig(auth, request);
105117
expect(response.recaptchaKey).to.eq('site-key');
@@ -119,7 +131,7 @@ describe('api/authentication/getRecaptchaConfig', () => {
119131
{
120132
error: {
121133
code: 400,
122-
message: ServerError.UNAUTHORIZED_DOMAIN,
134+
message: ServerError.UNAUTHORIZED_DOMAIN
123135
}
124136
},
125137
400
@@ -130,4 +142,4 @@ describe('api/authentication/getRecaptchaConfig', () => {
130142
'auth/unauthorized-continue-uri'
131143
);
132144
});
133-
});
145+
});

packages/auth/src/api/authentication/recaptcha.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { Endpoint, HttpMethod, RecaptchaClientType, RecaptchaVersion, _performApiRequest, _addTidIfNecessary } from '../index';
18+
import {
19+
Endpoint,
20+
HttpMethod,
21+
RecaptchaClientType,
22+
RecaptchaVersion,
23+
_performApiRequest,
24+
_addTidIfNecessary
25+
} from '../index';
1926
import { Auth, RecaptchaConfig } from '../../model/public_types';
2027

2128
interface GetRecaptchaParamResponse {
@@ -42,13 +49,17 @@ interface GetRecaptchaConfigRequest {
4249

4350
interface GetRecaptchaConfigResponse {
4451
recaptchaKey?: string;
45-
recaptchaConfig?: RecaptchaConfig
52+
recaptchaConfig?: RecaptchaConfig;
4653
}
4754

48-
export async function getRecaptchaConfig(auth: Auth,
55+
export async function getRecaptchaConfig(
56+
auth: Auth,
4957
request: GetRecaptchaConfigRequest
5058
): Promise<GetRecaptchaConfigResponse> {
51-
return _performApiRequest<GetRecaptchaConfigRequest, GetRecaptchaConfigResponse>(
59+
return _performApiRequest<
60+
GetRecaptchaConfigRequest,
61+
GetRecaptchaConfigResponse
62+
>(
5263
auth,
5364
HttpMethod.GET,
5465
Endpoint.GET_RECAPTCHA_CONFIG,

packages/auth/src/api/authentication/sign_up.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ import chaiAsPromised from 'chai-as-promised';
2020

2121
import { FirebaseError } from '@firebase/util';
2222

23-
import { Endpoint, HttpHeader, RecaptchaClientType, RecaptchaVersion } from '../';
23+
import {
24+
Endpoint,
25+
HttpHeader,
26+
RecaptchaClientType,
27+
RecaptchaVersion
28+
} from '../';
2429
import { mockEndpoint } from '../../../test/helpers/api/helper';
2530
import { testAuth, TestAuth } from '../../../test/helpers/mock_auth';
2631
import * as mockFetch from '../../../test/helpers/mock_fetch';
@@ -36,8 +41,8 @@ describe('api/authentication/signUp', () => {
3641
password: 'my-password',
3742
captchaResponse: 'recaptcha-token',
3843
clientType: RecaptchaClientType.WEB,
39-
recaptchaVersion: RecaptchaVersion.ENTERPRISE,
40-
};
44+
recaptchaVersion: RecaptchaVersion.ENTERPRISE
45+
};
4146

4247
let auth: TestAuth;
4348

packages/auth/src/api/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,23 @@ export const enum Endpoint {
6666
FINALIZE_MFA_SIGN_IN = '/v2/accounts/mfaSignIn:finalize',
6767
WITHDRAW_MFA = '/v2/accounts/mfaEnrollment:withdraw',
6868
GET_PROJECT_CONFIG = '/v1/projects',
69-
GET_RECAPTCHA_CONFIG = '/v2/recaptchaConfig',
69+
GET_RECAPTCHA_CONFIG = '/v2/recaptchaConfig'
7070
}
7171

7272
export const enum RecaptchaClientType {
7373
WEB = 'CLIENT_TYPE_WEB',
7474
ANDROID = 'CLIENT_TYPE_ANDROID',
75-
IOS = 'CLIENT_TYPE_IOS',
75+
IOS = 'CLIENT_TYPE_IOS'
7676
}
7777

7878
export const enum RecaptchaVersion {
79-
ENTERPRISE = 'RECAPTCHA_ENTERPRISE',
79+
ENTERPRISE = 'RECAPTCHA_ENTERPRISE'
8080
}
8181

8282
export const enum RecaptchaActionName {
8383
SIGN_IN_WITH_PASSWORD = 'signInWithPassword',
8484
GET_OOB_CODE = 'getOobCode',
85-
SIGN_UP_PASSWORD = 'signUpPassword',
85+
SIGN_UP_PASSWORD = 'signUpPassword'
8686
}
8787

8888
export const DEFAULT_API_TIMEOUT_MS = new Delay(30_000, 60_000);

0 commit comments

Comments
 (0)