Files
openzeppelin-contracts/test/token/ERC20/RBACMintableToken.behaviour.js
Nicolás Venturo cea2a85a42 Remove Babel (#1074)
* Test helpers no longer rely on Babel.

* Behaviours are no longer imported.

* Removed Babel dependency.

* Fixed linter errors.
2018-07-18 19:37:16 -03:00

33 lines
1.1 KiB
JavaScript

const { expectThrow } = require('../../helpers/expectThrow');
const ROLE_MINTER = 'minter';
function shouldBehaveLikeRBACMintableToken ([owner, anotherAccount]) {
describe('handle roles', function () {
it('owner can add and remove a minter role', async function () {
await this.token.addMinter(anotherAccount, { from: owner });
let hasRole = await this.token.hasRole(anotherAccount, ROLE_MINTER);
assert.equal(hasRole, true);
await this.token.removeMinter(anotherAccount, { from: owner });
hasRole = await this.token.hasRole(anotherAccount, ROLE_MINTER);
assert.equal(hasRole, false);
});
it('another account can\'t add or remove a minter role', async function () {
await expectThrow(
this.token.addMinter(anotherAccount, { from: anotherAccount })
);
await this.token.addMinter(anotherAccount, { from: owner });
await expectThrow(
this.token.removeMinter(anotherAccount, { from: anotherAccount })
);
});
});
}
module.exports = {
shouldBehaveLikeRBACMintableToken,
};