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
@ -15,14 +15,14 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.pause({ from });
|
||||
|
||||
const paused = await this.token.paused();
|
||||
assert.equal(paused, true);
|
||||
paused.should.be.true;
|
||||
});
|
||||
|
||||
it('emits a Pause event', async function () {
|
||||
const { logs } = await this.token.pause({ from });
|
||||
|
||||
assert.equal(logs.length, 1);
|
||||
assert.equal(logs[0].event, 'Pause');
|
||||
logs.length.should.eq(1);
|
||||
logs[0].event.should.eq('Pause');
|
||||
});
|
||||
});
|
||||
|
||||
@ -59,14 +59,14 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.unpause({ from });
|
||||
|
||||
const paused = await this.token.paused();
|
||||
assert.equal(paused, false);
|
||||
paused.should.be.false;
|
||||
});
|
||||
|
||||
it('emits an Unpause event', async function () {
|
||||
const { logs } = await this.token.unpause({ from });
|
||||
|
||||
assert.equal(logs.length, 1);
|
||||
assert.equal(logs[0].event, 'Unpause');
|
||||
logs.length.should.eq(1);
|
||||
logs[0].event.should.eq('Unpause');
|
||||
});
|
||||
});
|
||||
|
||||
@ -93,14 +93,14 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
it('is not paused by default', async function () {
|
||||
const paused = await this.token.paused({ from });
|
||||
|
||||
assert.equal(paused, false);
|
||||
paused.should.be.false;
|
||||
});
|
||||
|
||||
it('is paused after being paused', async function () {
|
||||
await this.token.pause({ from });
|
||||
const paused = await this.token.paused({ from });
|
||||
|
||||
assert.equal(paused, true);
|
||||
paused.should.be.true;
|
||||
});
|
||||
|
||||
it('is not paused after being paused and then unpaused', async function () {
|
||||
@ -108,7 +108,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.unpause({ from });
|
||||
const paused = await this.token.paused();
|
||||
|
||||
assert.equal(paused, false);
|
||||
paused.should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
@ -117,10 +117,10 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.transfer(recipient, 100, { from: owner });
|
||||
|
||||
const senderBalance = await this.token.balanceOf(owner);
|
||||
assert.equal(senderBalance, 0);
|
||||
senderBalance.should.be.bignumber.equal(0);
|
||||
|
||||
const recipientBalance = await this.token.balanceOf(recipient);
|
||||
assert.equal(recipientBalance, 100);
|
||||
recipientBalance.should.be.bignumber.equal(100);
|
||||
});
|
||||
|
||||
it('allows to transfer when paused and then unpaused', async function () {
|
||||
@ -130,10 +130,10 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.transfer(recipient, 100, { from: owner });
|
||||
|
||||
const senderBalance = await this.token.balanceOf(owner);
|
||||
assert.equal(senderBalance, 0);
|
||||
senderBalance.should.be.bignumber.equal(0);
|
||||
|
||||
const recipientBalance = await this.token.balanceOf(recipient);
|
||||
assert.equal(recipientBalance, 100);
|
||||
recipientBalance.should.be.bignumber.equal(100);
|
||||
});
|
||||
|
||||
it('reverts when trying to transfer when paused', async function () {
|
||||
@ -148,7 +148,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.approve(anotherAccount, 40, { from: owner });
|
||||
|
||||
const allowance = await this.token.allowance(owner, anotherAccount);
|
||||
assert.equal(allowance, 40);
|
||||
allowance.should.be.bignumber.equal(40);
|
||||
});
|
||||
|
||||
it('allows to transfer when paused and then unpaused', async function () {
|
||||
@ -158,7 +158,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.approve(anotherAccount, 40, { from: owner });
|
||||
|
||||
const allowance = await this.token.allowance(owner, anotherAccount);
|
||||
assert.equal(allowance, 40);
|
||||
allowance.should.be.bignumber.equal(40);
|
||||
});
|
||||
|
||||
it('reverts when trying to transfer when paused', async function () {
|
||||
@ -177,10 +177,10 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.transferFrom(owner, recipient, 40, { from: anotherAccount });
|
||||
|
||||
const senderBalance = await this.token.balanceOf(owner);
|
||||
assert.equal(senderBalance, 60);
|
||||
senderBalance.should.be.bignumber.equal(60);
|
||||
|
||||
const recipientBalance = await this.token.balanceOf(recipient);
|
||||
assert.equal(recipientBalance, 40);
|
||||
recipientBalance.should.be.bignumber.equal(40);
|
||||
});
|
||||
|
||||
it('allows to transfer when paused and then unpaused', async function () {
|
||||
@ -190,10 +190,10 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.transferFrom(owner, recipient, 40, { from: anotherAccount });
|
||||
|
||||
const senderBalance = await this.token.balanceOf(owner);
|
||||
assert.equal(senderBalance, 60);
|
||||
senderBalance.should.be.bignumber.equal(60);
|
||||
|
||||
const recipientBalance = await this.token.balanceOf(recipient);
|
||||
assert.equal(recipientBalance, 40);
|
||||
recipientBalance.should.be.bignumber.equal(40);
|
||||
});
|
||||
|
||||
it('reverts when trying to transfer from when paused', async function () {
|
||||
@ -212,7 +212,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.decreaseApproval(anotherAccount, 40, { from: owner });
|
||||
|
||||
const allowance = await this.token.allowance(owner, anotherAccount);
|
||||
assert.equal(allowance, 60);
|
||||
allowance.should.be.bignumber.equal(60);
|
||||
});
|
||||
|
||||
it('allows to decrease approval when paused and then unpaused', async function () {
|
||||
@ -222,7 +222,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.decreaseApproval(anotherAccount, 40, { from: owner });
|
||||
|
||||
const allowance = await this.token.allowance(owner, anotherAccount);
|
||||
assert.equal(allowance, 60);
|
||||
allowance.should.be.bignumber.equal(60);
|
||||
});
|
||||
|
||||
it('reverts when trying to transfer when paused', async function () {
|
||||
@ -241,7 +241,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.increaseApproval(anotherAccount, 40, { from: owner });
|
||||
|
||||
const allowance = await this.token.allowance(owner, anotherAccount);
|
||||
assert.equal(allowance, 140);
|
||||
allowance.should.be.bignumber.equal(140);
|
||||
});
|
||||
|
||||
it('allows to increase approval when paused and then unpaused', async function () {
|
||||
@ -251,7 +251,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
|
||||
await this.token.increaseApproval(anotherAccount, 40, { from: owner });
|
||||
|
||||
const allowance = await this.token.allowance(owner, anotherAccount);
|
||||
assert.equal(allowance, 140);
|
||||
allowance.should.be.bignumber.equal(140);
|
||||
});
|
||||
|
||||
it('reverts when trying to increase approval when paused', async function () {
|
||||
|
||||
Reference in New Issue
Block a user