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:
Yohann Pereira
2019-06-24 16:40:05 -04:00
committed by Francisco Giordano
parent 852e11c2db
commit 489d2e85f1
57 changed files with 564 additions and 453 deletions

View File

@ -1,23 +1,24 @@
const { BN, constants, expectEvent, expectRevert } = require('openzeppelin-test-helpers');
const { expect } = require('chai');
const { ZERO_ADDRESS } = constants;
function shouldBehaveLikeERC20 (errorPrefix, initialSupply, initialHolder, recipient, anotherAccount) {
describe('total supply', function () {
it('returns the total amount of tokens', async function () {
(await this.token.totalSupply()).should.be.bignumber.equal(initialSupply);
expect(await this.token.totalSupply()).to.be.bignumber.equal(initialSupply);
});
});
describe('balanceOf', function () {
describe('when the requested account has no tokens', function () {
it('returns zero', async function () {
(await this.token.balanceOf(anotherAccount)).should.be.bignumber.equal('0');
expect(await this.token.balanceOf(anotherAccount)).to.be.bignumber.equal('0');
});
});
describe('when the requested account has some tokens', function () {
it('returns the total amount of tokens', async function () {
(await this.token.balanceOf(initialHolder)).should.be.bignumber.equal(initialSupply);
expect(await this.token.balanceOf(initialHolder)).to.be.bignumber.equal(initialSupply);
});
});
});
@ -50,15 +51,15 @@ function shouldBehaveLikeERC20 (errorPrefix, initialSupply, initialHolder, recip
it('transfers the requested amount', async function () {
await this.token.transferFrom(tokenOwner, to, amount, { from: spender });
(await this.token.balanceOf(tokenOwner)).should.be.bignumber.equal('0');
expect(await this.token.balanceOf(tokenOwner)).to.be.bignumber.equal('0');
(await this.token.balanceOf(to)).should.be.bignumber.equal(amount);
expect(await this.token.balanceOf(to)).to.be.bignumber.equal(amount);
});
it('decreases the spender allowance', async function () {
await this.token.transferFrom(tokenOwner, to, amount, { from: spender });
(await this.token.allowance(tokenOwner, spender)).should.be.bignumber.equal('0');
expect(await this.token.allowance(tokenOwner, spender)).to.be.bignumber.equal('0');
});
it('emits a transfer event', async function () {
@ -176,9 +177,9 @@ function shouldBehaveLikeERC20Transfer (errorPrefix, from, to, balance, transfer
it('transfers the requested amount', async function () {
await transfer.call(this, from, to, amount);
(await this.token.balanceOf(from)).should.be.bignumber.equal('0');
expect(await this.token.balanceOf(from)).to.be.bignumber.equal('0');
(await this.token.balanceOf(to)).should.be.bignumber.equal(amount);
expect(await this.token.balanceOf(to)).to.be.bignumber.equal(amount);
});
it('emits a transfer event', async function () {
@ -198,9 +199,9 @@ function shouldBehaveLikeERC20Transfer (errorPrefix, from, to, balance, transfer
it('transfers the requested amount', async function () {
await transfer.call(this, from, to, amount);
(await this.token.balanceOf(from)).should.be.bignumber.equal(balance);
expect(await this.token.balanceOf(from)).to.be.bignumber.equal(balance);
(await this.token.balanceOf(to)).should.be.bignumber.equal('0');
expect(await this.token.balanceOf(to)).to.be.bignumber.equal('0');
});
it('emits a transfer event', async function () {
@ -243,7 +244,7 @@ function shouldBehaveLikeERC20Approve (errorPrefix, owner, spender, supply, appr
it('approves the requested amount', async function () {
await approve.call(this, owner, spender, amount);
(await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
expect(await this.token.allowance(owner, spender)).to.be.bignumber.equal(amount);
});
});
@ -255,7 +256,7 @@ function shouldBehaveLikeERC20Approve (errorPrefix, owner, spender, supply, appr
it('approves the requested amount and replaces the previous one', async function () {
await approve.call(this, owner, spender, amount);
(await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
expect(await this.token.allowance(owner, spender)).to.be.bignumber.equal(amount);
});
});
});
@ -277,7 +278,7 @@ function shouldBehaveLikeERC20Approve (errorPrefix, owner, spender, supply, appr
it('approves the requested amount', async function () {
await approve.call(this, owner, spender, amount);
(await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
expect(await this.token.allowance(owner, spender)).to.be.bignumber.equal(amount);
});
});
@ -289,7 +290,7 @@ function shouldBehaveLikeERC20Approve (errorPrefix, owner, spender, supply, appr
it('approves the requested amount and replaces the previous one', async function () {
await approve.call(this, owner, spender, amount);
(await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
expect(await this.token.allowance(owner, spender)).to.be.bignumber.equal(amount);
});
});
});