Removed redundant modifiers from CappedToken. (#969)
This commit is contained in:
@ -1,36 +1,17 @@
|
||||
|
||||
import expectThrow from '../../helpers/expectThrow';
|
||||
import ether from '../../helpers/ether';
|
||||
import shouldBehaveLikeMintableToken from './MintableToken.behaviour';
|
||||
import shouldBehaveLikeCappedToken from './CappedToken.behaviour';
|
||||
|
||||
var CappedToken = artifacts.require('CappedToken');
|
||||
|
||||
contract('Capped', function (accounts) {
|
||||
const cap = ether(1000);
|
||||
|
||||
let token;
|
||||
|
||||
contract('Capped', function ([owner, anotherAccount]) {
|
||||
const _cap = ether(1000);
|
||||
|
||||
beforeEach(async function () {
|
||||
token = await CappedToken.new(cap);
|
||||
this.token = await CappedToken.new(_cap, { from: owner });
|
||||
});
|
||||
|
||||
it('should start with the correct cap', async function () {
|
||||
let _cap = await token.cap();
|
||||
shouldBehaveLikeCappedToken([owner, anotherAccount, owner, _cap]);
|
||||
|
||||
assert(cap.eq(_cap));
|
||||
});
|
||||
|
||||
it('should mint when amount is less than cap', async function () {
|
||||
const result = await token.mint(accounts[0], 100);
|
||||
assert.equal(result.logs[0].event, 'Mint');
|
||||
});
|
||||
|
||||
it('should fail to mint if the ammount exceeds the cap', async function () {
|
||||
await token.mint(accounts[0], cap.sub(1));
|
||||
await expectThrow(token.mint(accounts[0], 100));
|
||||
});
|
||||
|
||||
it('should fail to mint after cap is reached', async function () {
|
||||
await token.mint(accounts[0], cap);
|
||||
await expectThrow(token.mint(accounts[0], 1));
|
||||
});
|
||||
shouldBehaveLikeMintableToken([owner, anotherAccount, owner]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user