Remove Babel (#1074)
* Test helpers no longer rely on Babel. * Behaviours are no longer imported. * Removed Babel dependency. * Fixed linter errors.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import latestTime from './latestTime';
|
||||
const { latestTime } = require('./latestTime');
|
||||
|
||||
// Increases ganache time by the passed duration in seconds
|
||||
export default function increaseTime (duration) {
|
||||
function increaseTime (duration) {
|
||||
const id = Date.now();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -31,14 +31,15 @@ export default function increaseTime (duration) {
|
||||
*
|
||||
* @param target time in seconds
|
||||
*/
|
||||
export async function increaseTimeTo (target) {
|
||||
async function increaseTimeTo (target) {
|
||||
let now = (await latestTime());
|
||||
|
||||
if (target < now) throw Error(`Cannot increase current time(${now}) to a moment in the past(${target})`);
|
||||
let diff = target - now;
|
||||
return increaseTime(diff);
|
||||
}
|
||||
|
||||
export const duration = {
|
||||
const duration = {
|
||||
seconds: function (val) { return val; },
|
||||
minutes: function (val) { return val * this.seconds(60); },
|
||||
hours: function (val) { return val * this.minutes(60); },
|
||||
@ -46,3 +47,9 @@ export const duration = {
|
||||
weeks: function (val) { return val * this.days(7); },
|
||||
years: function (val) { return val * this.days(365); },
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
increaseTime,
|
||||
increaseTimeTo,
|
||||
duration,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user