Remove chai-as-promised (#1116)

* Test: Remove chai-as-promised calls

* Test/Helpers: expectThrow accepts optional message

* NPM: Remove chai-as-promised

* Contracts/DestructibleMock: Fix lint
This commit is contained in:
Justus Perlwitz
2018-07-26 23:53:33 +09:00
committed by Nicolás Venturo
parent afe9113b18
commit e6c15b34da
39 changed files with 261 additions and 326 deletions

View File

@ -1,3 +1,4 @@
const { expectThrow } = require('../helpers/expectThrow');
const { EVMRevert } = require('../helpers/EVMRevert');
const expectEvent = require('../helpers/expectEvent');
const { ethGetBalance } = require('../helpers/web3');
@ -28,17 +29,17 @@ contract('RefundEscrow', function ([owner, beneficiary, refundee1, refundee2]) {
it('does not refund refundees', async function () {
await this.escrow.deposit(refundee1, { from: owner, value: amount });
await this.escrow.withdraw(refundee1).should.be.rejectedWith(EVMRevert);
await expectThrow(this.escrow.withdraw(refundee1), EVMRevert);
});
it('does not allow beneficiary withdrawal', async function () {
await this.escrow.deposit(refundee1, { from: owner, value: amount });
await this.escrow.beneficiaryWithdraw().should.be.rejectedWith(EVMRevert);
await expectThrow(this.escrow.beneficiaryWithdraw(), EVMRevert);
});
});
it('only owner can enter closed state', async function () {
await this.escrow.close({ from: beneficiary }).should.be.rejectedWith(EVMRevert);
await expectThrow(this.escrow.close({ from: beneficiary }), EVMRevert);
const receipt = await this.escrow.close({ from: owner });
@ -53,11 +54,11 @@ contract('RefundEscrow', function ([owner, beneficiary, refundee1, refundee2]) {
});
it('rejects deposits', async function () {
await this.escrow.deposit(refundee1, { from: owner, value: amount }).should.be.rejectedWith(EVMRevert);
await expectThrow(this.escrow.deposit(refundee1, { from: owner, value: amount }), EVMRevert);
});
it('does not refund refundees', async function () {
await this.escrow.withdraw(refundee1).should.be.rejectedWith(EVMRevert);
await expectThrow(this.escrow.withdraw(refundee1), EVMRevert);
});
it('allows beneficiary withdrawal', async function () {
@ -70,7 +71,7 @@ contract('RefundEscrow', function ([owner, beneficiary, refundee1, refundee2]) {
});
it('only owner can enter refund state', async function () {
await this.escrow.enableRefunds({ from: beneficiary }).should.be.rejectedWith(EVMRevert);
await expectThrow(this.escrow.enableRefunds({ from: beneficiary }), EVMRevert);
const receipt = await this.escrow.enableRefunds({ from: owner });
@ -85,7 +86,7 @@ contract('RefundEscrow', function ([owner, beneficiary, refundee1, refundee2]) {
});
it('rejects deposits', async function () {
await this.escrow.deposit(refundee1, { from: owner, value: amount }).should.be.rejectedWith(EVMRevert);
await expectThrow(this.escrow.deposit(refundee1, { from: owner, value: amount }), EVMRevert);
});
it('refunds refundees', async function () {
@ -99,7 +100,7 @@ contract('RefundEscrow', function ([owner, beneficiary, refundee1, refundee2]) {
});
it('does not allow beneficiary withdrawal', async function () {
await this.escrow.beneficiaryWithdraw().should.be.rejectedWith(EVMRevert);
await expectThrow(this.escrow.beneficiaryWithdraw(), EVMRevert);
});
});
});