CappedToken.behaviour.js 970 B

12345678910111213141516171819202122232425262728
  1. import expectThrow from '../../helpers/expectThrow';
  2. export default function ([owner, anotherAccount, minter, cap]) {
  3. describe('capped token', function () {
  4. const from = minter;
  5. it('should start with the correct cap', async function () {
  6. let _cap = await this.token.cap();
  7. assert(cap.eq(_cap));
  8. });
  9. it('should mint when amount is less than cap', async function () {
  10. const result = await this.token.mint(owner, cap.sub(1), { from });
  11. assert.equal(result.logs[0].event, 'Mint');
  12. });
  13. it('should fail to mint if the ammount exceeds the cap', async function () {
  14. await this.token.mint(owner, cap.sub(1), { from });
  15. await expectThrow(this.token.mint(owner, 100, { from }));
  16. });
  17. it('should fail to mint after cap is reached', async function () {
  18. await this.token.mint(owner, cap, { from });
  19. await expectThrow(this.token.mint(owner, 1, { from }));
  20. });
  21. });
  22. }