Fix remaining crowdsale tests.

This commit is contained in:
Nicolás Venturo
2019-01-11 16:03:11 -03:00
parent 3e85ec771c
commit 91ec765791
4 changed files with 9 additions and 9 deletions

View File

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

View File

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

View File

@ -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 () {

View File

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