Replace all asserts with chai.should (#1183)
* Moving towards chai.should. * Fixed failing tests. * Fixed linter errors. * Revert package-lock.json changes. * Fixed failing tests. * s/eq/equal * Addressed review comment
This commit is contained in:
committed by
Francisco Giordano
parent
a2e7103869
commit
ac91af9a6a
@ -1,6 +1,12 @@
|
||||
const { assertRevert } = require('../helpers/assertRevert');
|
||||
const PausableMock = artifacts.require('PausableMock');
|
||||
|
||||
const BigNumber = web3.BigNumber;
|
||||
|
||||
require('chai')
|
||||
.use(require('chai-bignumber')(BigNumber))
|
||||
.should();
|
||||
|
||||
contract('Pausable', function () {
|
||||
beforeEach(async function () {
|
||||
this.Pausable = await PausableMock.new();
|
||||
@ -8,27 +14,28 @@ contract('Pausable', function () {
|
||||
|
||||
it('can perform normal process in non-pause', async function () {
|
||||
const count0 = await this.Pausable.count();
|
||||
assert.equal(count0, 0);
|
||||
count0.should.be.bignumber.equal(0);
|
||||
|
||||
await this.Pausable.normalProcess();
|
||||
const count1 = await this.Pausable.count();
|
||||
assert.equal(count1, 1);
|
||||
count1.should.be.bignumber.equal(1);
|
||||
});
|
||||
|
||||
it('can not perform normal process in pause', async function () {
|
||||
await this.Pausable.pause();
|
||||
const count0 = await this.Pausable.count();
|
||||
assert.equal(count0, 0);
|
||||
count0.should.be.bignumber.equal(0);
|
||||
|
||||
await assertRevert(this.Pausable.normalProcess());
|
||||
const count1 = await this.Pausable.count();
|
||||
assert.equal(count1, 0);
|
||||
count1.should.be.bignumber.equal(0);
|
||||
});
|
||||
|
||||
it('can not take drastic measure in non-pause', async function () {
|
||||
await assertRevert(this.Pausable.drasticMeasure());
|
||||
const drasticMeasureTaken = await this.Pausable.drasticMeasureTaken();
|
||||
assert.isFalse(drasticMeasureTaken);
|
||||
|
||||
drasticMeasureTaken.should.be.false;
|
||||
});
|
||||
|
||||
it('can take a drastic measure in a pause', async function () {
|
||||
@ -36,7 +43,7 @@ contract('Pausable', function () {
|
||||
await this.Pausable.drasticMeasure();
|
||||
const drasticMeasureTaken = await this.Pausable.drasticMeasureTaken();
|
||||
|
||||
assert.isTrue(drasticMeasureTaken);
|
||||
drasticMeasureTaken.should.be.true;
|
||||
});
|
||||
|
||||
it('should resume allowing normal process after pause is over', async function () {
|
||||
@ -45,7 +52,7 @@ contract('Pausable', function () {
|
||||
await this.Pausable.normalProcess();
|
||||
const count0 = await this.Pausable.count();
|
||||
|
||||
assert.equal(count0, 1);
|
||||
count0.should.be.bignumber.equal(1);
|
||||
});
|
||||
|
||||
it('should prevent drastic measure after pause is over', async function () {
|
||||
@ -55,6 +62,6 @@ contract('Pausable', function () {
|
||||
await assertRevert(this.Pausable.drasticMeasure());
|
||||
|
||||
const drasticMeasureTaken = await this.Pausable.drasticMeasureTaken();
|
||||
assert.isFalse(drasticMeasureTaken);
|
||||
drasticMeasureTaken.should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user