ERC721PausableToken.test.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const { shouldBehaveLikeERC721PausedToken } = require('./ERC721PausedToken.behavior');
  2. const { shouldBehaveLikeERC721BasicToken } = require('./ERC721BasicToken.behavior');
  3. const BigNumber = web3.BigNumber;
  4. const ERC721PausableToken = artifacts.require('ERC721PausableTokenMock.sol');
  5. require('chai')
  6. .use(require('chai-bignumber')(BigNumber))
  7. .should();
  8. contract('ERC721PausableToken', function ([_, owner, recipient, operator, ...otherAccounts]) {
  9. beforeEach(async function () {
  10. this.token = await ERC721PausableToken.new({ from: owner });
  11. });
  12. context('when token is paused', function () {
  13. beforeEach(async function () {
  14. await this.token.pause({ from: owner });
  15. });
  16. shouldBehaveLikeERC721PausedToken(owner, [...otherAccounts]);
  17. });
  18. context('when token is not paused yet', function () {
  19. shouldBehaveLikeERC721BasicToken([owner, ...otherAccounts]);
  20. });
  21. context('when token is paused and then unpaused', function () {
  22. beforeEach(async function () {
  23. await this.token.pause({ from: owner });
  24. await this.token.unpause({ from: owner });
  25. });
  26. shouldBehaveLikeERC721BasicToken([owner, ...otherAccounts]);
  27. });
  28. });