Firebase Stub: introduced a delay in all async functions to better mimic real Firebase

This commit is contained in:
gianantoniopini
2021-01-21 16:45:33 +01:00
parent 562a07619c
commit af966bdf7b
6 changed files with 42 additions and 18 deletions

View File

@ -2,6 +2,7 @@
import { v4 as uuidv4 } from 'uuid';
import Constants from '../constants/auth';
import delay from '../utils/index';
const singleton = Symbol('');
const singletonEnforcer = Symbol('');
@ -49,6 +50,8 @@ class Auth {
async signInAnonymously() {
const user = Constants.anonymousUser1;
await delay(Constants.defaultDelayInMilliseconds);
this.onAuthStateChangedObservers.forEach((observer) => observer(user));
return Promise.resolve(user);