use setMockedTime in longest commitTime test

This commit is contained in:
perissology 2017-10-24 10:07:12 -07:00
parent 31e511393d
commit 1729939374
1 changed files with 5 additions and 5 deletions

View File

@ -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
})
});