RBACMintableToken.behavior.js 881 B

12345678910111213141516171819202122232425262728
  1. const { expectThrow } = require('../../helpers/expectThrow');
  2. function shouldBehaveLikeRBACMintableToken (owner, [anyone]) {
  3. describe('handle roles', function () {
  4. it('owner can add and remove a minter role', async function () {
  5. await this.token.addMinter(anyone, { from: owner });
  6. (await this.token.isMinter(anyone)).should.equal(true);
  7. await this.token.removeMinter(anyone, { from: owner });
  8. (await this.token.isMinter(anyone)).should.equal(false);
  9. });
  10. it('anyone can\'t add or remove a minter role', async function () {
  11. await expectThrow(
  12. this.token.addMinter(anyone, { from: anyone })
  13. );
  14. await this.token.addMinter(anyone, { from: owner });
  15. await expectThrow(
  16. this.token.removeMinter(anyone, { from: anyone })
  17. );
  18. });
  19. });
  20. }
  21. module.exports = {
  22. shouldBehaveLikeRBACMintableToken,
  23. };