Skip to content

Commit 93af87f

Browse files
committed
Formatting
1 parent aaa5cd2 commit 93af87f

File tree

1 file changed

+60
-20
lines changed

1 file changed

+60
-20
lines changed
Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
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, use } from 'chai';
219
import * as chaiAsPromised from 'chai-as-promised';
320

421
import {
5-
createUserWithEmailAndPassword, EmailAuthProvider, linkWithCredential, signInAnonymously,
6-
signInWithEmailAndPassword, updateEmail, updatePassword
22+
createUserWithEmailAndPassword,
23+
EmailAuthProvider,
24+
linkWithCredential,
25+
signInAnonymously,
26+
signInWithEmailAndPassword,
27+
updateEmail,
28+
updatePassword
729
} from '@firebase/auth-exp/index.browser';
830
import { OperationType } from '@firebase/auth-types-exp';
931
import { FirebaseError } from '@firebase/util';
1032

11-
import { initIntegrationTestContext, randomEmail } from '../../helpers/integration/helpers';
33+
import {
34+
initIntegrationTestContext,
35+
randomEmail
36+
} from '../../helpers/integration/helpers';
1237

1338
use(chaiAsPromised);
1439

1540
describe('Integration test: anonymous auth', () => {
1641
const auth = initIntegrationTestContext();
17-
42+
1843
it('signs in anonymously', async () => {
1944
const userCred = await signInAnonymously(auth);
2045
expect(auth.currentUser).to.eq(userCred.user);
@@ -26,8 +51,8 @@ describe('Integration test: anonymous auth', () => {
2651
});
2752

2853
it('second sign in on the same device yields same user', async () => {
29-
const {user: userA} = await signInAnonymously(auth);
30-
const {user: userB} = await signInAnonymously(auth);
54+
const { user: userA } = await signInAnonymously(auth);
55+
const { user: userB } = await signInAnonymously(auth);
3156

3257
expect(userA.uid).to.eq(userB.uid);
3358
});
@@ -41,41 +66,56 @@ describe('Integration test: anonymous auth', () => {
4166

4267
it('anonymous / email-password accounts remain independent', async () => {
4368
let anonCred = await signInAnonymously(auth);
44-
const emailCred = await createUserWithEmailAndPassword(auth, email, 'password');
69+
const emailCred = await createUserWithEmailAndPassword(
70+
auth,
71+
email,
72+
'password'
73+
);
4574
expect(emailCred.user.uid).not.to.eql(anonCred.user.uid);
46-
75+
4776
await auth.signOut();
48-
anonCred = await signInAnonymously(auth);
49-
const emailSignIn = await signInWithEmailAndPassword(auth, email, 'password');
77+
anonCred = await signInAnonymously(auth);
78+
const emailSignIn = await signInWithEmailAndPassword(
79+
auth,
80+
email,
81+
'password'
82+
);
5083
expect(emailCred.user.uid).to.eql(emailSignIn.user.uid);
5184
expect(emailSignIn.user.uid).not.to.eql(anonCred.user.uid);
5285
});
53-
86+
5487
it('account can be upgraded by setting email and password', async () => {
55-
const {user} = await signInAnonymously(auth);
88+
const { user } = await signInAnonymously(auth);
5689
await updateEmail(user, email);
5790
await updatePassword(user, 'password');
58-
91+
5992
const anonId = user.uid;
6093
await auth.signOut();
61-
expect((await signInWithEmailAndPassword(auth, email, 'password')).user.uid).to.eq(anonId);
94+
expect(
95+
(await signInWithEmailAndPassword(auth, email, 'password')).user.uid
96+
).to.eq(anonId);
6297
});
63-
98+
6499
it('account can be linked using email and password', async () => {
65-
const {user} = await signInAnonymously(auth);
100+
const { user } = await signInAnonymously(auth);
66101
const cred = EmailAuthProvider.credential(email, 'password');
67102
const id = user.uid;
68103
await linkWithCredential(user, cred);
69104
await auth.signOut();
70105

71-
expect((await signInWithEmailAndPassword(auth, email, 'password')).user.uid).to.eq(id);
106+
expect(
107+
(await signInWithEmailAndPassword(auth, email, 'password')).user.uid
108+
).to.eq(id);
72109
});
73110

74111
it('account cannot be linked with existing email/password', async () => {
75112
await createUserWithEmailAndPassword(auth, email, 'password');
76-
const {user: anonUser} = await signInAnonymously(auth);
113+
const { user: anonUser } = await signInAnonymously(auth);
77114
const cred = EmailAuthProvider.credential(email, 'password');
78-
await expect(linkWithCredential(anonUser, cred)).to.be.rejectedWith(FirebaseError, 'auth/email-already-in-use');
115+
await expect(linkWithCredential(anonUser, cred)).to.be.rejectedWith(
116+
FirebaseError,
117+
'auth/email-already-in-use'
118+
);
79119
});
80120
});
81-
});
121+
});

0 commit comments

Comments
 (0)