ERC20Capped.test.js 891 B

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