Files
openzeppelin-contracts/test/token/ERC20/SafeERC20.test.js
Nicolás Venturo b0da0fded0 Replaced assertJump, assertRevert and expectThrow with shouldFail. (#1363)
* Replaced assertJump, assertRevert and expectThrow with shouldFail.

* Fixed linter errors.

* Fixed typo.

* Made the helpers async.
2018-10-09 16:23:55 -03:00

37 lines
1.0 KiB
JavaScript

const shouldFail = require('../../helpers/shouldFail');
require('chai')
.should();
const SafeERC20Helper = artifacts.require('SafeERC20Helper');
contract('SafeERC20', function () {
beforeEach(async function () {
this.helper = await SafeERC20Helper.new();
});
it('should throw on failed transfer', async function () {
await shouldFail.reverting(this.helper.doFailingTransfer());
});
it('should throw on failed transferFrom', async function () {
await shouldFail.reverting(this.helper.doFailingTransferFrom());
});
it('should throw on failed approve', async function () {
await shouldFail.reverting(this.helper.doFailingApprove());
});
it('should not throw on succeeding transfer', async function () {
await this.helper.doSucceedingTransfer();
});
it('should not throw on succeeding transferFrom', async function () {
await this.helper.doSucceedingTransferFrom();
});
it('should not throw on succeeding approve', async function () {
await this.helper.doSucceedingApprove();
});
});