Skip to content

Commit

Permalink
test: revoking leaves some tokens vestable
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyrharper committed Dec 2, 2023
1 parent 780a9dd commit e828cb8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/TokenVesting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,30 @@ describe.only("TokenVesting", function () {
expect(await this.joe.balanceOf(this.tokenVesting.address)).to.lt(100)
})

it("should allow all tokens to be vested once all time has passed", async function() {
it("should allow all tokens to be vested once all time has passed", async function () {
await increase(duration.days(14))
await this.tokenVesting.release(this.joe.address)
expect(await this.joe.balanceOf(this.alice.address)).to.equal(100)
expect(await this.joe.balanceOf(this.tokenVesting.address)).to.equal(0)
})

it("can revoke tokens immediately", async function() {
await this.tokenVesting.revoke(this.joe.address);
await increase(duration.days(14));
it("can revoke tokens immediately", async function () {
await this.tokenVesting.revoke(this.joe.address)
await increase(duration.days(14))
await expect(this.tokenVesting.release(this.joe.address)).to.be.revertedWith("TokenVesting: no tokens are due")
})

});
it("revoking leaves some tokens vestable", async function () {
await increase(duration.days(10))
await this.tokenVesting.revoke(this.joe.address)
await this.tokenVesting.release(this.joe.address)

expect(await this.joe.balanceOf(this.alice.address)).to.gt(0)
expect(await this.joe.balanceOf(this.tokenVesting.address)).to.lt(100)

await increase(duration.days(7))
await expect(this.tokenVesting.release(this.joe.address)).to.be.revertedWith("TokenVesting: no tokens are due")
})

after(async function () {
await network.provider.request({
Expand Down

0 comments on commit e828cb8

Please sign in to comment.