Dashboard: updated unit tests for Delete resume

This commit is contained in:
gianantoniopini
2021-01-22 16:42:21 +01:00
parent cb2aeec70a
commit dc18e84bc2
3 changed files with 63 additions and 30 deletions

View File

@ -1,6 +1,5 @@
/* eslint-disable no-underscore-dangle */
import { v4 as uuidv4 } from 'uuid';
import { debounce } from 'lodash';
import DatabaseConstants from '../constants/database';
import DataSnapshot from './dataSnapshot';
@ -148,11 +147,7 @@ class Reference {
? this._dataSnapshot
: new DataSnapshot(() => this._getData(), snapshotValue);
const debouncedEventCallback = debounce(
this.eventCallbacks[eventType],
DatabaseConstants.defaultDelayInMilliseconds,
);
debouncedEventCallback(snapshot);
this.eventCallbacks[eventType](snapshot);
}
equalTo(value) {
@ -173,7 +168,9 @@ class Reference {
this.eventCallbacks[eventType] = callback;
if (eventType === DatabaseConstants.valueEventType) {
this.triggerEventCallback(eventType);
setTimeout(() => {
this.triggerEventCallback(eventType);
}, DatabaseConstants.defaultDelayInMilliseconds);
}
return callback;