Files
openzeppelin-contracts/test/token/ERC20/behaviors/ERC20Capped.behavior.js
Aniket 70fd243e3b Test setup helper added (#1482)
* signing prefix added

* Minor improvement

* Tests changed

* Successfully tested

* Minor improvements

* Minor improvements

* Revert "Dangling commas are now required. (#1359)"

This reverts commit a6889776f4.

* updates

* fixes #1404

* approve failing test

* suggested changes done

* ISafeERC20 removed

* conflict fixes

* fixes #1205

* minor change

* suggested changes

* reviewed changes

* final update
2018-12-07 13:32:48 -03:00

33 lines
1.0 KiB
JavaScript

const shouldFail = require('../../../helpers/shouldFail');
require('../../../helpers/setup');
function shouldBehaveLikeERC20Capped (minter, [anyone], cap) {
describe('capped token', function () {
const from = minter;
it('should start with the correct cap', async function () {
(await this.token.cap()).should.be.bignumber.equal(cap);
});
it('should mint when amount is less than cap', async function () {
await this.token.mint(anyone, cap.sub(1), { from });
(await this.token.totalSupply()).should.be.bignumber.equal(cap.sub(1));
});
it('should fail to mint if the ammount exceeds the cap', async function () {
await this.token.mint(anyone, cap.sub(1), { from });
await shouldFail.reverting(this.token.mint(anyone, 100, { from }));
});
it('should fail to mint after cap is reached', async function () {
await this.token.mint(anyone, cap, { from });
await shouldFail.reverting(this.token.mint(anyone, 1, { from }));
});
});
}
module.exports = {
shouldBehaveLikeERC20Capped,
};