Refactor assert revert helper to encapsulate promises (#628)
This commit is contained in:
committed by
Federico Bond
parent
4ce0e211c5
commit
323d1fa941
@ -1,7 +1,7 @@
|
||||
'user strict';
|
||||
|
||||
const assertRevert = require('./helpers/assertRevert');
|
||||
var PausableTokenMock = artifacts.require('mocks/PausableTokenMock.sol');
|
||||
import assertRevert from './helpers/assertRevert';
|
||||
var PausableTokenMock = artifacts.require('./mocks/PausableTokenMock.sol');
|
||||
|
||||
contract('PausableToken', function (accounts) {
|
||||
let token;
|
||||
@ -53,21 +53,11 @@ contract('PausableToken', function (accounts) {
|
||||
|
||||
it('should throw an error trying to transfer while transactions are paused', async function () {
|
||||
await token.pause();
|
||||
try {
|
||||
await token.transfer(accounts[1], 100);
|
||||
assert.fail('should have thrown before');
|
||||
} catch (error) {
|
||||
assertRevert(error);
|
||||
}
|
||||
await assertRevert(token.transfer(accounts[1], 100));
|
||||
});
|
||||
|
||||
it('should throw an error trying to transfer from another account while transactions are paused', async function () {
|
||||
await token.pause();
|
||||
try {
|
||||
await token.transferFrom(accounts[0], accounts[1], 100);
|
||||
assert.fail('should have thrown before');
|
||||
} catch (error) {
|
||||
assertRevert(error);
|
||||
}
|
||||
await assertRevert(token.transferFrom(accounts[0], accounts[1], 100));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user