ERC721Royalty.test.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const { BN, constants } = require('@openzeppelin/test-helpers');
  2. const { shouldBehaveLikeERC2981 } = require('../../common/ERC2981.behavior');
  3. const ERC721Royalty = artifacts.require('$ERC721Royalty');
  4. contract('ERC721Royalty', function (accounts) {
  5. const [account1, account2] = accounts;
  6. const tokenId1 = new BN('1');
  7. const tokenId2 = new BN('2');
  8. const royalty = new BN('200');
  9. const salePrice = new BN('1000');
  10. beforeEach(async function () {
  11. this.token = await ERC721Royalty.new('My Token', 'TKN');
  12. await this.token.$_mint(account1, tokenId1);
  13. await this.token.$_mint(account1, tokenId2);
  14. this.account1 = account1;
  15. this.account2 = account2;
  16. this.tokenId1 = tokenId1;
  17. this.tokenId2 = tokenId2;
  18. this.salePrice = salePrice;
  19. });
  20. describe('token specific functions', function () {
  21. beforeEach(async function () {
  22. await this.token.$_setTokenRoyalty(tokenId1, account1, royalty);
  23. });
  24. it('removes royalty information after burn', async function () {
  25. await this.token.$_burn(tokenId1);
  26. const tokenInfo = await this.token.royaltyInfo(tokenId1, salePrice);
  27. expect(tokenInfo[0]).to.be.equal(constants.ZERO_ADDRESS);
  28. expect(tokenInfo[1]).to.be.bignumber.equal(new BN('0'));
  29. });
  30. });
  31. shouldBehaveLikeERC2981();
  32. });