fix a problem when revoke is called twice

This commit is contained in:
Francisco Giordano
2017-10-09 19:01:04 -03:00
parent 5aba967db9
commit 01b92d1d56
2 changed files with 24 additions and 9 deletions

View File

@ -80,8 +80,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
});
it('should return the non-vested tokens when revoked by owner', async function () {
await increaseTimeTo(this.start + this.cliff + duration.weeks(1));
await this.vesting.release(this.token.address);
await increaseTimeTo(this.start + this.cliff + duration.weeks(12));
const vested = await this.vesting.vestedAmount(this.token.address);
const balance = await this.token.balanceOf(this.vesting.address);
@ -93,15 +92,25 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
});
it('should keep the vested tokens when revoked by owner', async function () {
await increaseTimeTo(this.start + this.cliff + duration.weeks(1));
await this.vesting.release(this.token.address);
await increaseTimeTo(this.start + this.cliff + duration.weeks(12));
const vestedPre = await this.vesting.vestedAmount(this.token.address);
await this.vesting.revoke(this.token.address, { from: owner });
const vestedPost = await this.vesting.vestedAmount(this.token.address);
vestedPre.should.bignumber.equal(vestedPost);
});
it('should fail to be revoked a second time', async function () {
await increaseTimeTo(this.start + this.cliff + duration.weeks(12));
const vested = await this.vesting.vestedAmount(this.token.address);
await this.vesting.revoke(this.token.address, { from: owner });
const balance = await this.token.balanceOf(this.vesting.address);
balance.should.bignumber.equal(vested);
await this.vesting.revoke(this.token.address, { from: owner }).should.be.rejectedWith(EVMThrow);
});
});