fix a problem when revoke is called twice
This commit is contained in:
@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user