make VestedToken test deterministic

This commit is contained in:
Manuel Araoz
2017-02-10 18:32:58 -03:00
parent 0b71dcded2
commit b67f60929c
3 changed files with 40 additions and 21 deletions

View File

@ -1,5 +1,17 @@
// timer for tests specific to testrpc
module.exports = s => {
return new Promise(resolve => {
setTimeout(() => resolve(), s * 1000 + 600) // 600ms breathing room for testrpc to sync
})
}
console.log('timer to', s);
return new Promise((resolve, reject) => {
web3.currentProvider.sendAsync({
jsonrpc: '2.0',
method: 'evm_increaseTime',
params: [s], // 60 seaconds, may need to be hex, I forget
id: new Date().getTime() // Id of the request; anything works, really
}, function(err) {
console.log('resolved to', err);
if (err) return reject(err);
resolve();
});
//setTimeout(() => resolve(), s * 1000 + 600) // 600ms breathing room for testrpc to sync
});
};