ERC20Capped.test.js 811 B

123456789101112131415161718192021222324252627
  1. const { BN, ether, expectRevert } = require('@openzeppelin/test-helpers');
  2. const { shouldBehaveLikeERC20Capped } = require('./ERC20Capped.behavior');
  3. const ERC20Capped = artifacts.require('ERC20CappedMock');
  4. contract('ERC20Capped', function (accounts) {
  5. const [ minter, ...otherAccounts ] = accounts;
  6. const cap = ether('1000');
  7. const name = 'My Token';
  8. const symbol = 'MTKN';
  9. it('requires a non-zero cap', async function () {
  10. await expectRevert(
  11. ERC20Capped.new(name, symbol, new BN(0), { from: minter }), 'ERC20Capped: cap is 0',
  12. );
  13. });
  14. context('once deployed', async function () {
  15. beforeEach(async function () {
  16. this.token = await ERC20Capped.new(name, symbol, cap, { from: minter });
  17. });
  18. shouldBehaveLikeERC20Capped(minter, otherAccounts, cap);
  19. });
  20. });