Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improved descriptions of added tests.
  • Loading branch information
nventuro committed Aug 24, 2018
commit 33a6c5d7a7a557bb0cfa375f8e46b0f6285ffc0b
2 changes: 1 addition & 1 deletion test/crowdsale/CappedCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract('CappedCrowdsale', function ([_, wallet]) {
this.token = await SimpleToken.new();
});

it('requires a non-zero cap', async function () {
it('rejects a cap of zero', async function () {
await expectThrow(
CappedCrowdsale.new(rate, wallet, this.token.address, 0),
EVMRevert,
Expand Down
4 changes: 2 additions & 2 deletions test/crowdsale/IncreasingPriceCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser])
this.token = await SimpleToken.new();
});

it('requires a final rate smaller than the initial rate', async function () {
it('rejects a final rate larger than the initial rate', async function () {
await assertRevert(IncreasingPriceCrowdsale.new(
this.startTime, this.closingTime, wallet, this.token.address, initialRate, initialRate.plus(1)
));
});

it('requires a non-zero final rate', async function () {
it('rejects a final rate of zero', async function () {
await assertRevert(IncreasingPriceCrowdsale.new(
this.startTime, this.closingTime, wallet, this.token.address, initialRate, 0
));
Expand Down
8 changes: 4 additions & 4 deletions test/crowdsale/PostDeliveryCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
});

it('should not immediately assign tokens to beneficiary', async function () {
it('does not immediately assign tokens to beneficiaries', async function () {
(await this.token.balanceOf(investor)).should.be.bignumber.equal(0);
});

it('should not allow beneficiaries to withdraw tokens before crowdsale ends', async function () {
it('does not allow beneficiaries to withdraw tokens before crowdsale ends', async function () {
await expectThrow(this.crowdsale.withdrawTokens({ from: investor }), EVMRevert);
});

Expand All @@ -59,12 +59,12 @@ contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
await increaseTimeTo(this.afterClosingTime);
});

it('should allow beneficiaries to withdraw tokens', async function () {
it('allows beneficiaries to withdraw tokens', async function () {
await this.crowdsale.withdrawTokens({ from: investor });
(await this.token.balanceOf(investor)).should.be.bignumber.equal(value);
});

it('should ony allow a single withdrawal', async function () {
it('rejects multiple withdrawals', async function () {
await this.crowdsale.withdrawTokens({ from: investor });
await expectThrow(this.crowdsale.withdrawTokens({ from: investor }), EVMRevert);
});
Expand Down
12 changes: 6 additions & 6 deletions test/crowdsale/RefundableCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor, purchaser
this.token = await SimpleToken.new();
});

it('it requires a non-zero goal', async function () {
it('rejects a goal of zero', async function () {
await expectThrow(
RefundableCrowdsale.new(
this.openingTime, this.closingTime, rate, wallet, this.token.address, 0, { from: owner }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests would be a lot clearer if we had a helper like newRefundableCrowdsale({ goal: 0}) that just used the default values for everything else.

Expand All @@ -54,7 +54,7 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor, purchaser
});

context('before opening time', function () {
it('should deny refunds', async function () {
it('denies refunds', async function () {
await expectThrow(this.crowdsale.claimRefund({ from: investor }), EVMRevert);
});
});
Expand All @@ -64,7 +64,7 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor, purchaser
await increaseTimeTo(this.openingTime);
});

it('should deny refunds', async function () {
it('denies refunds', async function () {
await expectThrow(this.crowdsale.claimRefund({ from: investor }), EVMRevert);
});

Expand All @@ -79,7 +79,7 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor, purchaser
await this.crowdsale.finalize({ from: owner });
});

it('should refund', async function () {
it('refunds', async function () {
const pre = await ethGetBalance(investor);
await this.crowdsale.claimRefund({ from: investor, gasPrice: 0 });
const post = await ethGetBalance(investor);
Expand All @@ -99,11 +99,11 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor, purchaser
await this.crowdsale.finalize({ from: owner });
});

it('should deny refunds', async function () {
it('denies refunds', async function () {
await expectThrow(this.crowdsale.claimRefund({ from: investor }), EVMRevert);
});

it('should forward funds to wallet', async function () {
it('forwards funds to wallet', async function () {
const postWalletBalance = await ethGetBalance(wallet);
postWalletBalance.minus(this.preWalletBalance).should.be.bignumber.equal(goal);
});
Expand Down
10 changes: 5 additions & 5 deletions test/payment/SplitPayment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1,
const amount = web3.toWei(1.0, 'ether');
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';

it('cannot be created with no payees', async function () {
it('rejects an empty set of payees', async function () {
await expectThrow(SplitPayment.new([], []), EVMRevert);
});

it('requires shares for each payee', async function () {
it('rejects more payees than shares', async function () {
await expectThrow(SplitPayment.new([payee1, payee2, payee3], [20, 30]), EVMRevert);
});

it('requires a payee for each share', async function () {
it('rejects more shares than payees', async function () {
await expectThrow(SplitPayment.new([payee1, payee2], [20, 30, 40]), EVMRevert);
});

it('requires non-null payees', async function () {
it('rejects null payees', async function () {
await expectThrow(SplitPayment.new([payee1, ZERO_ADDRESS], [20, 30]), EVMRevert);
});

it('requires non-zero shares', async function () {
it('rejects zero-valued shares', async function () {
await expectThrow(SplitPayment.new([payee1, payee2], [20, 0]), EVMRevert);
});

Expand Down