Files
openzeppelin-contracts/test/token/ERC20/ERC20Capped.test.js
Balaji Pachai 3682c6575c Added message string for require() (#1704)
* Error handling in ERC20 and ERC721

* Added message string for require.

* Fixed solhint errors.

* Updated PR as per issue #1709

* changes as per #1709 and openzeppelin forum.

* Changes in require statement

* Changes in require statement

* build pipeline fix

* Changes as per @nventuro's comment.

* Update revert reason strings.

* Fianal update of revert reason strings.

* WIP: Updating reason strings in test cases

* WIP: Added changes to ERC20 and ERC721

* Fixes linting errors in *.tes.js files

* Achieved 100% code coverage

* Updated the test cases with shouldFail.reverting.withMessage()

* Fix package-lock.

* address review comments

* fix linter issues

* fix remaining revert reasons
2019-04-24 11:17:08 -03:00

25 lines
870 B
JavaScript

const { BN, ether, shouldFail } = require('openzeppelin-test-helpers');
const { shouldBehaveLikeERC20Mintable } = require('./behaviors/ERC20Mintable.behavior');
const { shouldBehaveLikeERC20Capped } = require('./behaviors/ERC20Capped.behavior');
const ERC20Capped = artifacts.require('ERC20Capped');
contract('ERC20Capped', function ([_, minter, ...otherAccounts]) {
const cap = ether('1000');
it('requires a non-zero cap', async function () {
await shouldFail.reverting.withMessage(
ERC20Capped.new(new BN(0), { from: minter }), 'ERC20Capped: cap is 0'
);
});
context('once deployed', async function () {
beforeEach(async function () {
this.token = await ERC20Capped.new(cap, { from: minter });
});
shouldBehaveLikeERC20Capped(minter, otherAccounts, cap);
shouldBehaveLikeERC20Mintable(minter, otherAccounts);
});
});