|
@@ -1,8 +1,7 @@
|
|
|
-import expectThrow from '../../helpers/expectThrow';
|
|
|
+import shouldBehaveLikeRBACMintableToken from './RBACMintableToken.behaviour';
|
|
|
import shouldBehaveLikeMintableToken from './MintableToken.behaviour';
|
|
|
-const RBACMintableToken = artifacts.require('RBACMintableToken');
|
|
|
|
|
|
-const ROLE_MINTER = 'minter';
|
|
|
+const RBACMintableToken = artifacts.require('RBACMintableToken');
|
|
|
|
|
|
contract('RBACMintableToken', function ([owner, anotherAccount, minter]) {
|
|
|
beforeEach(async function () {
|
|
@@ -10,28 +9,6 @@ contract('RBACMintableToken', function ([owner, anotherAccount, minter]) {
|
|
|
await this.token.addMinter(minter, { from: owner });
|
|
|
});
|
|
|
|
|
|
- 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 })
|
|
|
- );
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
+ shouldBehaveLikeRBACMintableToken([owner, anotherAccount, minter]);
|
|
|
shouldBehaveLikeMintableToken([owner, anotherAccount, minter]);
|
|
|
});
|