No longer assigning awaits to temporary variables. (#1216)

This commit is contained in:
Nicolás Venturo
2018-08-17 16:10:40 -03:00
committed by GitHub
parent df9426f989
commit 20cf885430
43 changed files with 231 additions and 467 deletions

View File

@ -13,46 +13,36 @@ contract('Pausable', function () {
});
it('can perform normal process in non-pause', async function () {
const count0 = await this.Pausable.count();
count0.should.be.bignumber.equal(0);
(await this.Pausable.count()).should.be.bignumber.equal(0);
await this.Pausable.normalProcess();
const count1 = await this.Pausable.count();
count1.should.be.bignumber.equal(1);
(await this.Pausable.count()).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();
count0.should.be.bignumber.equal(0);
(await this.Pausable.count()).should.be.bignumber.equal(0);
await assertRevert(this.Pausable.normalProcess());
const count1 = await this.Pausable.count();
count1.should.be.bignumber.equal(0);
(await this.Pausable.count()).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();
drasticMeasureTaken.should.be.false;
(await this.Pausable.drasticMeasureTaken()).should.be.false;
});
it('can take a drastic measure in a pause', async function () {
await this.Pausable.pause();
await this.Pausable.drasticMeasure();
const drasticMeasureTaken = await this.Pausable.drasticMeasureTaken();
drasticMeasureTaken.should.be.true;
(await this.Pausable.drasticMeasureTaken()).should.be.true;
});
it('should resume allowing normal process after pause is over', async function () {
await this.Pausable.pause();
await this.Pausable.unpause();
await this.Pausable.normalProcess();
const count0 = await this.Pausable.count();
count0.should.be.bignumber.equal(1);
(await this.Pausable.count()).should.be.bignumber.equal(1);
});
it('should prevent drastic measure after pause is over', async function () {
@ -61,7 +51,6 @@ contract('Pausable', function () {
await assertRevert(this.Pausable.drasticMeasure());
const drasticMeasureTaken = await this.Pausable.drasticMeasureTaken();
drasticMeasureTaken.should.be.false;
(await this.Pausable.drasticMeasureTaken()).should.be.false;
});
});

View File

@ -29,15 +29,11 @@ contract('TokenDestructible', function ([_, owner]) {
it('should send tokens to owner after destruction', async function () {
const token = await StandardTokenMock.new(tokenDestructible.address, 100);
const initContractBalance = await token.balanceOf(tokenDestructible.address);
const initOwnerBalance = await token.balanceOf(owner);
initContractBalance.should.be.bignumber.equal(100);
initOwnerBalance.should.be.bignumber.equal(0);
(await token.balanceOf(tokenDestructible.address)).should.be.bignumber.equal(100);
(await token.balanceOf(owner)).should.be.bignumber.equal(0);
await tokenDestructible.destroy([token.address], { from: owner });
const newContractBalance = await token.balanceOf(tokenDestructible.address);
const newOwnerBalance = await token.balanceOf(owner);
newContractBalance.should.be.bignumber.equal(0);
newOwnerBalance.should.be.bignumber.equal(100);
(await token.balanceOf(tokenDestructible.address)).should.be.bignumber.equal(0);
(await token.balanceOf(owner)).should.be.bignumber.equal(100);
});
});