tests/utils/request_mock/xhr_mock.js
/**
   * Perform every locked requests and resolve once every one of them have
   * finished (either aborted, on error or finished succesfully).
   * Keep the lock on, if one.
   * @param {number} count
   * @returns {Promise}
   */
Perform every locked requests and resolve once every one of them have
finished (either aborted, on error or finished succesfully).
Keep the lock on, if one.
@param {number} count
@returns {Promise}
Perform every locked requests and resolve once every one of them have finished ( either aborted on error or finished succesfully ) . Keep the lock on if one . @param { number } count @returns { Promise }
flush(nbrOfRequests) {
    const len = this._sendingQueue.length;
    const proms = [];
    const nbrOfRequestsToFlush = nbrOfRequests !== undefined ?
      Math.min(len, nbrOfRequests) : len;
    const nbrOfRequestThatStays = len - nbrOfRequestsToFlush;
    while (this._sendingQueue.length > nbrOfRequestThatStays) {
      const { xhr, data } = this._sendingQueue.pop();
      this.__xhrSend(xhr, data);
      proms.push(xhr._finished);
    }
    return Promise.all(proms);
  }
flush ( nbrOfRequests ) { const len = this . _sendingQueue . length ; const proms = [ ] ; const nbrOfRequestsToFlush = nbrOfRequests !== undefined ? Math . min ( len , nbrOfRequests ) : len ; const nbrOfRequestThatStays = len - nbrOfRequestsToFlush ; while ( this . _sendingQueue . length > nbrOfRequestThatStays ) { const { xhr , data } = this . _sendingQueue . pop ( ) ; this . __xhrSend ( xhr , data ) ; proms . push ( xhr . _finished ) ; } return Promise . all ( proms ) ; }
Perform every locked requests and resolve once every one of them have
 finished (either aborted, on error or finished succesfully).
Perform every locked requests and resolve once every one of them have finished ( either aborted on error or finished succesfully ) .