Replace chai.should with chai.expect (#1780)
* changed exxpect to expect wherever applicable * Merged with latest branch * Updated merkleTree helper to latest master branch * Made linting fixes * Fix for test build * updated for Coverage * Updated Address.test.js * Undo package-lock changes.
This commit is contained in:
committed by
Francisco Giordano
parent
852e11c2db
commit
489d2e85f1
@ -1,5 +1,7 @@
|
||||
const { BN, balance, ether, expectRevert, time } = require('openzeppelin-test-helpers');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const SampleCrowdsale = artifacts.require('SampleCrowdsale');
|
||||
const SampleCrowdsaleToken = artifacts.require('SampleCrowdsaleToken');
|
||||
|
||||
@ -29,12 +31,12 @@ contract('SampleCrowdsale', function ([_, deployer, owner, wallet, investor]) {
|
||||
});
|
||||
|
||||
it('should create crowdsale with correct parameters', async function () {
|
||||
(await this.crowdsale.openingTime()).should.be.bignumber.equal(this.openingTime);
|
||||
(await this.crowdsale.closingTime()).should.be.bignumber.equal(this.closingTime);
|
||||
(await this.crowdsale.rate()).should.be.bignumber.equal(RATE);
|
||||
(await this.crowdsale.wallet()).should.be.equal(wallet);
|
||||
(await this.crowdsale.goal()).should.be.bignumber.equal(GOAL);
|
||||
(await this.crowdsale.cap()).should.be.bignumber.equal(CAP);
|
||||
expect(await this.crowdsale.openingTime()).to.be.bignumber.equal(this.openingTime);
|
||||
expect(await this.crowdsale.closingTime()).to.be.bignumber.equal(this.closingTime);
|
||||
expect(await this.crowdsale.rate()).to.be.bignumber.equal(RATE);
|
||||
expect(await this.crowdsale.wallet()).to.equal(wallet);
|
||||
expect(await this.crowdsale.goal()).to.be.bignumber.equal(GOAL);
|
||||
expect(await this.crowdsale.cap()).to.be.bignumber.equal(CAP);
|
||||
});
|
||||
|
||||
it('should not accept payments before start', async function () {
|
||||
@ -51,8 +53,8 @@ contract('SampleCrowdsale', function ([_, deployer, owner, wallet, investor]) {
|
||||
await time.increaseTo(this.openingTime);
|
||||
await this.crowdsale.buyTokens(investor, { value: investmentAmount, from: investor });
|
||||
|
||||
(await this.token.balanceOf(investor)).should.be.bignumber.equal(expectedTokenAmount);
|
||||
(await this.token.totalSupply()).should.be.bignumber.equal(expectedTokenAmount);
|
||||
expect(await this.token.balanceOf(investor)).to.be.bignumber.equal(expectedTokenAmount);
|
||||
expect(await this.token.totalSupply()).to.be.bignumber.equal(expectedTokenAmount);
|
||||
});
|
||||
|
||||
it('should reject payments after end', async function () {
|
||||
@ -76,7 +78,7 @@ contract('SampleCrowdsale', function ([_, deployer, owner, wallet, investor]) {
|
||||
const balanceTracker = await balance.tracker(wallet);
|
||||
await time.increaseTo(this.afterClosingTime);
|
||||
await this.crowdsale.finalize({ from: owner });
|
||||
(await balanceTracker.delta()).should.be.bignumber.equal(GOAL);
|
||||
expect(await balanceTracker.delta()).to.be.bignumber.equal(GOAL);
|
||||
});
|
||||
|
||||
it('should allow refunds if the goal is not reached', async function () {
|
||||
@ -89,7 +91,7 @@ contract('SampleCrowdsale', function ([_, deployer, owner, wallet, investor]) {
|
||||
await this.crowdsale.finalize({ from: owner });
|
||||
await this.crowdsale.claimRefund(investor, { gasPrice: 0 });
|
||||
|
||||
(await balanceTracker.delta()).should.be.bignumber.equal('0');
|
||||
expect(await balanceTracker.delta()).to.be.bignumber.equal('0');
|
||||
});
|
||||
|
||||
describe('when goal > cap', function () {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
const { constants, expectEvent } = require('openzeppelin-test-helpers');
|
||||
const { ZERO_ADDRESS } = constants;
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const SimpleToken = artifacts.require('SimpleToken');
|
||||
|
||||
contract('SimpleToken', function ([_, creator]) {
|
||||
@ -9,22 +11,22 @@ contract('SimpleToken', function ([_, creator]) {
|
||||
});
|
||||
|
||||
it('has a name', async function () {
|
||||
(await this.token.name()).should.equal('SimpleToken');
|
||||
expect(await this.token.name()).to.equal('SimpleToken');
|
||||
});
|
||||
|
||||
it('has a symbol', async function () {
|
||||
(await this.token.symbol()).should.equal('SIM');
|
||||
expect(await this.token.symbol()).to.equal('SIM');
|
||||
});
|
||||
|
||||
it('has 18 decimals', async function () {
|
||||
(await this.token.decimals()).should.be.bignumber.equal('18');
|
||||
expect(await this.token.decimals()).to.be.bignumber.equal('18');
|
||||
});
|
||||
|
||||
it('assigns the initial total supply to the creator', async function () {
|
||||
const totalSupply = await this.token.totalSupply();
|
||||
const creatorBalance = await this.token.balanceOf(creator);
|
||||
|
||||
creatorBalance.should.be.bignumber.equal(totalSupply);
|
||||
expect(creatorBalance).to.be.bignumber.equal(totalSupply);
|
||||
|
||||
await expectEvent.inConstruction(this.token, 'Transfer', {
|
||||
from: ZERO_ADDRESS,
|
||||
|
||||
Reference in New Issue
Block a user