Builder tests: added test for loading screen

This commit is contained in:
gianantoniopini
2021-01-20 15:52:35 +01:00
parent 1215071ab9
commit 4c63f68215
4 changed files with 56 additions and 30 deletions

View File

@ -20,6 +20,8 @@ const user2 = {
isAnonymous: AuthConstants.anonymousUser2.isAnonymous,
};
const defaultDelayInMilliseconds = 100;
class Database {
static get valueEventType() {
return valueEventType;
@ -60,6 +62,10 @@ class Database {
static get user2() {
return user2;
}
static get defaultDelayInMilliseconds() {
return defaultDelayInMilliseconds;
}
}
export default Database;

View File

@ -149,7 +149,7 @@ class Reference {
const debouncedEventCallback = debounce(
this.eventCallbacks[eventType],
100,
DatabaseConstants.defaultDelayInMilliseconds,
);
debouncedEventCallback(snapshot);
}
@ -183,6 +183,10 @@ class Reference {
throw new Error('eventType should be a string.');
}
await new Promise((resolve) =>
setTimeout(resolve, DatabaseConstants.defaultDelayInMilliseconds),
);
return Promise.resolve(this._dataSnapshot);
}