From 91ec76579129ebb8a9666b92b66736b55d8104a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Fri, 11 Jan 2019 16:03:11 -0300 Subject: [PATCH] Fix remaining crowdsale tests. --- test/crowdsale/CappedCrowdsale.test.js | 2 +- test/crowdsale/IncreasingPriceCrowdsale.test.js | 10 +++++----- test/crowdsale/IndividuallyCappedCrowdsale.test.js | 4 ++-- test/crowdsale/RefundableCrowdsale.test.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/crowdsale/CappedCrowdsale.test.js b/test/crowdsale/CappedCrowdsale.test.js index eb3a24457..37bfaedb3 100644 --- a/test/crowdsale/CappedCrowdsale.test.js +++ b/test/crowdsale/CappedCrowdsale.test.js @@ -46,7 +46,7 @@ contract('CappedCrowdsale', function ([_, wallet]) { }); it('should not reach cap if sent just under cap', async function () { - await this.crowdsale.send(cap.sub(1)); + await this.crowdsale.send(cap.subn(1)); (await this.crowdsale.capReached()).should.equal(false); }); diff --git a/test/crowdsale/IncreasingPriceCrowdsale.test.js b/test/crowdsale/IncreasingPriceCrowdsale.test.js index d28a9534b..376c1ccfb 100644 --- a/test/crowdsale/IncreasingPriceCrowdsale.test.js +++ b/test/crowdsale/IncreasingPriceCrowdsale.test.js @@ -19,9 +19,9 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser]) beforeEach(async function () { await time.advanceBlock(); - this.startTime = (await time.latest()).add(time).duration.weeks(1); - this.closingTime = this.startTime.add(time).duration.weeks(1); - this.afterClosingTime = this.closingTime.add(time).duration.seconds(1); + this.startTime = (await time.latest()).add(time.duration.weeks(1)); + this.closingTime = this.startTime.add(time.duration.weeks(1)); + this.afterClosingTime = this.closingTime.add(time.duration.seconds(1)); this.token = await SimpleToken.new(); }); @@ -66,7 +66,7 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser]) it('returns a rate of 0 after the crowdsale ends', async function () { await time.increaseTo(this.afterClosingTime); - (await this.crowdsale.getCurrentRate()).should.be.bignumber.equal(0); + (await this.crowdsale.getCurrentRate()).should.be.bignumber.equal('0'); }); it('at start', async function () { @@ -82,7 +82,7 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser]) }); it('at time 300', async function () { - await time.increaseTo(this.startTime.add(300)); + await time.increaseTo(this.startTime.addn(300)); await this.crowdsale.buyTokens(investor, { value, from: purchaser }); (await this.token.balanceOf(investor)).should.be.bignumber.equal(value.mul(rateAtTime300)); }); diff --git a/test/crowdsale/IndividuallyCappedCrowdsale.test.js b/test/crowdsale/IndividuallyCappedCrowdsale.test.js index 6bdf09de6..40a3bf71c 100644 --- a/test/crowdsale/IndividuallyCappedCrowdsale.test.js +++ b/test/crowdsale/IndividuallyCappedCrowdsale.test.js @@ -56,8 +56,8 @@ contract('IndividuallyCappedCrowdsale', function ( }); it('should reject payments that exceed cap', async function () { - await shouldFail.reverting(this.crowdsale.buyTokens(alice, { value: capAlice.add(1) })); - await shouldFail.reverting(this.crowdsale.buyTokens(bob, { value: capBob.add(1) })); + await shouldFail.reverting(this.crowdsale.buyTokens(alice, { value: capAlice.addn(1) })); + await shouldFail.reverting(this.crowdsale.buyTokens(bob, { value: capBob.addn(1) })); }); it('should manage independent caps', async function () { diff --git a/test/crowdsale/RefundableCrowdsale.test.js b/test/crowdsale/RefundableCrowdsale.test.js index be2acf38f..feb134bbf 100644 --- a/test/crowdsale/RefundableCrowdsale.test.js +++ b/test/crowdsale/RefundableCrowdsale.test.js @@ -89,7 +89,7 @@ contract('RefundableCrowdsale', function ([_, wallet, investor, purchaser, anyon it('forwards funds to wallet', async function () { const postWalletBalance = await balance.current(wallet); - postWalletBalance.minus(this.preWalletBalance).should.be.bignumber.equal(goal); + postWalletBalance.sub(this.preWalletBalance).should.be.bignumber.equal(goal); }); }); });