src/utils/index.js
function increaseProviderTime(provider, time, callback) {
  if (typeof time !== 'number') {
    callback('error while increasing TestRPC provider time, time value must be a number.', null);
    return;
  }

  provider.sendAsync({
    method: 'evm_increaseTime',
    params: [time],
  }, (increaseTimeError) => {
    if (increaseTimeError) {
      callback(`error while increasing TestRPC provider time: ${JSON.stringify(increaseTimeError)}`, null);
    } else {
      provider.sendAsync({
        method: 'evm_mine',
      }, (mineError) => {
        if (mineError) {
          callback(`while mining block to increase time on TestRPC provider: ${JSON.stringify(mineError)}`, null);
        } else {
          callback(null, true);
        }
      });
    }
  });
}
function increaseProviderTime(provider, time, callback) {
  if (typeof time !== 'number') {
    callback('error while increasing TestRPC provider time, time value must be a number.', null);
    return;
  }

  provider.sendAsync({
    method: 'evm_increaseTime',
    params: [time],
  }, (increaseTimeError) => {
    if (increaseTimeError) {
      callback(`error while increasing TestRPC provider time: ${JSON.stringify(increaseTimeError)}`, null);
    } else {
      provider.sendAsync({
        method: 'evm_mine',
      }, (mineError) => {
        if (mineError) {
          callback(`while mining block to increase time on TestRPC provider: ${JSON.stringify(mineError)}`, null);
        } else {
          callback(null, true);
        }
      });
    }
  });
}
function increaseProviderTime ( provider , time , callback ) { if ( typeof time !== 'number' ) { callback ( 'error while increasing TestRPC provider time, time value must be a number.' , null ) ; return ; } provider . sendAsync ( { method : 'evm_increaseTime' , params : [ time ] , } , ( increaseTimeError ) => { if ( increaseTimeError ) { callback ( ` ${ JSON . stringify ( increaseTimeError ) } ` , null ) ; } else { provider . sendAsync ( { method : 'evm_mine' , } , ( mineError ) => { if ( mineError ) { callback ( ` ${ JSON . stringify ( mineError ) } ` , null ) ; } else { callback ( null , true ) ; } } ) ; } } ) ; }
increase the testrpc provider time by a specific amount, then mine
increase the testrpc provider time by a specific amount then mine