Jest mocks: added @reach/router and stub for Firebase auth signOut method

This commit is contained in:
gianantoniopini
2021-05-13 16:53:04 +02:00
parent ffb8ae45e0
commit d11d414504
5 changed files with 100 additions and 14 deletions

View File

@ -57,7 +57,7 @@ class Auth {
user.email,
user.isAnonymous,
user.uid,
async () => {},
this.signOut,
);
await delay(Constants.defaultDelayInMilliseconds);
@ -68,6 +68,20 @@ class Auth {
return this._currentUser;
}
async signOut() {
if (this._currentUser === null) {
return;
}
this._currentUser = null;
await delay(Constants.defaultDelayInMilliseconds);
this.onAuthStateChangedObservers.forEach((observer) =>
observer(this._currentUser),
);
}
}
export default Auth;

View File

@ -1,6 +1,6 @@
const deleteUserFunctionName = 'deleteUser';
const defaultDelayInMilliseconds = 2000;
const defaultDelayInMilliseconds = 100;
class Functions {
static get deleteUserFunctionName() {