-
Notifications
You must be signed in to change notification settings - Fork 138
/
firebase.js
49 lines (43 loc) · 1.14 KB
/
firebase.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import {Factory} from 'rosie';
class FirebaseError extends Error {
constructor(args) {
super(args.name);
this.code = args.name;
this.credential = args.credential;
Error.captureStackTrace(this, FirebaseError);
}
}
export const credentialFactory = new Factory().attrs({
providerId: 'github.com',
accessToken: 'abc123',
});
export const firebaseErrorFactory = Factory.define(
'firebaseError',
FirebaseError,
).attrs({
name: 'some other error',
});
export const credentialInUseErrorFactory = new Factory()
.extend(firebaseErrorFactory)
.attrs({
name: 'auth/credential-already-in-use',
credential: () => credentialFactory.build(),
});
export const userProviderDataFactory = new Factory().attrs({
displayName: 'popcoder',
email: null,
phoneNumber: null,
photoUrl: null,
providerId: 'github.com',
uid: '1234567',
});
export const userFactory = new Factory().extend(userProviderDataFactory).attrs({
emailVerified: false,
isAnonymous: false,
metadata: {
creationTime: Date.now(),
lastSignInTime: Date.now(),
},
providerData: () => [userProviderDataFactory.build()],
refreshToken: 'token123',
});