Files
openzeppelin-contracts/test/token/ERC20/RBACMintableToken.behavior.js
Nicolás Venturo ac91af9a6a Replace all asserts with chai.should (#1183)
* Moving towards chai.should.

* Fixed failing tests.

* Fixed linter errors.

* Revert package-lock.json changes.

* Fixed failing tests.

* s/eq/equal

* Addressed review comment
2018-08-10 19:03:04 -03:00

33 lines
1010 B
JavaScript

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