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,6 +1,8 @@
|
||||
const { BN, constants, expectRevert } = require('openzeppelin-test-helpers');
|
||||
const { MAX_UINT256 } = constants;
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const SafeMathMock = artifacts.require('SafeMathMock');
|
||||
|
||||
contract('SafeMath', function () {
|
||||
@ -9,8 +11,8 @@ contract('SafeMath', function () {
|
||||
});
|
||||
|
||||
async function testCommutative (fn, lhs, rhs, expected) {
|
||||
(await fn(lhs, rhs)).should.be.bignumber.equal(expected);
|
||||
(await fn(rhs, lhs)).should.be.bignumber.equal(expected);
|
||||
expect(await fn(lhs, rhs)).to.be.bignumber.equal(expected);
|
||||
expect(await fn(rhs, lhs)).to.be.bignumber.equal(expected);
|
||||
}
|
||||
|
||||
async function testFailsCommutative (fn, lhs, rhs, reason) {
|
||||
@ -39,7 +41,7 @@ contract('SafeMath', function () {
|
||||
const a = new BN('5678');
|
||||
const b = new BN('1234');
|
||||
|
||||
(await this.safeMath.sub(a, b)).should.be.bignumber.equal(a.sub(b));
|
||||
expect(await this.safeMath.sub(a, b)).to.be.bignumber.equal(a.sub(b));
|
||||
});
|
||||
|
||||
it('reverts if subtraction result would be negative', async function () {
|
||||
@ -78,21 +80,21 @@ contract('SafeMath', function () {
|
||||
const a = new BN('5678');
|
||||
const b = new BN('5678');
|
||||
|
||||
(await this.safeMath.div(a, b)).should.be.bignumber.equal(a.div(b));
|
||||
expect(await this.safeMath.div(a, b)).to.be.bignumber.equal(a.div(b));
|
||||
});
|
||||
|
||||
it('divides zero correctly', async function () {
|
||||
const a = new BN('0');
|
||||
const b = new BN('5678');
|
||||
|
||||
(await this.safeMath.div(a, b)).should.be.bignumber.equal('0');
|
||||
expect(await this.safeMath.div(a, b)).to.be.bignumber.equal('0');
|
||||
});
|
||||
|
||||
it('returns complete number result on non-even division', async function () {
|
||||
const a = new BN('7000');
|
||||
const b = new BN('5678');
|
||||
|
||||
(await this.safeMath.div(a, b)).should.be.bignumber.equal('1');
|
||||
expect(await this.safeMath.div(a, b)).to.be.bignumber.equal('1');
|
||||
});
|
||||
|
||||
it('reverts on divison by zero', async function () {
|
||||
@ -109,28 +111,28 @@ contract('SafeMath', function () {
|
||||
const a = new BN('284');
|
||||
const b = new BN('5678');
|
||||
|
||||
(await this.safeMath.mod(a, b)).should.be.bignumber.equal(a.mod(b));
|
||||
expect(await this.safeMath.mod(a, b)).to.be.bignumber.equal(a.mod(b));
|
||||
});
|
||||
|
||||
it('when the dividend is equal to the divisor', async function () {
|
||||
const a = new BN('5678');
|
||||
const b = new BN('5678');
|
||||
|
||||
(await this.safeMath.mod(a, b)).should.be.bignumber.equal(a.mod(b));
|
||||
expect(await this.safeMath.mod(a, b)).to.be.bignumber.equal(a.mod(b));
|
||||
});
|
||||
|
||||
it('when the dividend is larger than the divisor', async function () {
|
||||
const a = new BN('7000');
|
||||
const b = new BN('5678');
|
||||
|
||||
(await this.safeMath.mod(a, b)).should.be.bignumber.equal(a.mod(b));
|
||||
expect(await this.safeMath.mod(a, b)).to.be.bignumber.equal(a.mod(b));
|
||||
});
|
||||
|
||||
it('when the dividend is a multiple of the divisor', async function () {
|
||||
const a = new BN('17034'); // 17034 == 5678 * 3
|
||||
const b = new BN('5678');
|
||||
|
||||
(await this.safeMath.mod(a, b)).should.be.bignumber.equal(a.mod(b));
|
||||
expect(await this.safeMath.mod(a, b)).to.be.bignumber.equal(a.mod(b));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user