From 17299393747bb615d8038851cdab1038f460e1b2 Mon Sep 17 00:00:00 2001 From: perissology Date: Tue, 24 Oct 2017 10:07:12 -0700 Subject: [PATCH] use setMockedTime in longest commitTime test --- test/DelegationChain.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/DelegationChain.js b/test/DelegationChain.js index 4cf1837..9030942 100644 --- a/test/DelegationChain.js +++ b/test/DelegationChain.js @@ -169,14 +169,14 @@ describe('DelegationChain test', function () { // delegate1 add delegate2 to chain await liquidPledging.transfer(2, 2, 1000, 3, {from: delegate1, $extraGas: 100000}); - // propose project delegation + // set the time const now = Math.floor(new Date().getTime() / 1000); + await liquidPledging.setMockedTime(now); + + // propose project delegation await liquidPledging.transfer(3, 3, 1000, 5, { from: delegate2, $extraGas: 100000 }); const pledge = await liquidPledging.getPledge(8); - // due to how block timestamp differences, we can't check an exact time - // the commitTimes for the pledgeAdmins are as follows giver - 86400, delegate1 - 259200, delegate2 - 0 - // therefore checking within 1000 ms means that the longest commitTime was choosen - assert.approximately(web3.utils.toDecimal(pledge.commitTime), now + 259200, 1000); // 259200 is longest commitTime in delegationChain + assert.equal(pledge.commitTime, now + 259200); // 259200 is longest commitTime in delegationChain }) });