ERC721Pausable.test.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const { shouldBehaveLikeERC721PausedToken } = require('./ERC721PausedToken.behavior');
  2. const { shouldBehaveLikeERC721Basic } = require('./ERC721Basic.behavior');
  3. const BigNumber = web3.BigNumber;
  4. const ERC721Pausable = artifacts.require('ERC721PausableMock.sol');
  5. require('chai')
  6. .use(require('chai-bignumber')(BigNumber))
  7. .should();
  8. contract('ERC721Pausable', function ([_, owner, recipient, operator, ...otherAccounts]) {
  9. beforeEach(async function () {
  10. this.token = await ERC721Pausable.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. shouldBehaveLikeERC721Basic([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. shouldBehaveLikeERC721Basic([owner, ...otherAccounts]);
  27. });
  28. });