Replaced assertJump, assertRevert and expectThrow with shouldFail. (#1363)

* Replaced assertJump, assertRevert and expectThrow with shouldFail.

* Fixed linter errors.

* Fixed typo.

* Made the helpers async.

(cherry picked from commit b0da0fded0)
This commit is contained in:
Nicolás Venturo
2018-10-09 16:23:55 -03:00
committed by Leo Arias
parent 620d524398
commit 7cd0d5a452
45 changed files with 274 additions and 344 deletions

View File

@ -1,4 +1,4 @@
const { expectThrow } = require('../helpers/expectThrow');
const shouldFail = require('../helpers/shouldFail');
const ReentrancyMock = artifacts.require('ReentrancyMock');
const ReentrancyAttack = artifacts.require('ReentrancyAttack');
@ -16,7 +16,7 @@ contract('ReentrancyGuard', function () {
it('should not allow remote callback', async function () {
const attacker = await ReentrancyAttack.new();
await expectThrow(this.reentrancyMock.countAndCall(attacker.address));
await shouldFail.reverting(this.reentrancyMock.countAndCall(attacker.address));
});
// The following are more side-effects than intended behavior:
@ -24,10 +24,10 @@ contract('ReentrancyGuard', function () {
// in the side-effects.
it('should not allow local recursion', async function () {
await expectThrow(this.reentrancyMock.countLocalRecursive(10));
await shouldFail.reverting(this.reentrancyMock.countLocalRecursive(10));
});
it('should not allow indirect local recursion', async function () {
await expectThrow(this.reentrancyMock.countThisRecursive(10));
await shouldFail.reverting(this.reentrancyMock.countThisRecursive(10));
});
});