Commit ba0fd11f by Jatin Kathuria Committed by Nicolás Venturo

Renamed symbols as as a part of Issue#1148 (#1891)

parent 635a3814
...@@ -6,7 +6,7 @@ const { expect } = require('chai'); ...@@ -6,7 +6,7 @@ const { expect } = require('chai');
const { shouldBehaveLikeERC721 } = require('./ERC721.behavior'); const { shouldBehaveLikeERC721 } = require('./ERC721.behavior');
const ERC721Mock = artifacts.require('ERC721Mock.sol'); const ERC721Mock = artifacts.require('ERC721Mock.sol');
contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) { contract('ERC721', function ([_, creator, owner, other, ...accounts]) {
beforeEach(async function () { beforeEach(async function () {
this.token = await ERC721Mock.new({ from: creator }); this.token = await ERC721Mock.new({ from: creator });
}); });
...@@ -25,20 +25,20 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) { ...@@ -25,20 +25,20 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
context('with minted token', async function () { context('with minted token', async function () {
beforeEach(async function () { beforeEach(async function () {
({ logs: this.logs } = await this.token.mint(tokenOwner, tokenId)); ({ logs: this.logs } = await this.token.mint(owner, tokenId));
}); });
it('emits a Transfer event', function () { it('emits a Transfer event', function () {
expectEvent.inLogs(this.logs, 'Transfer', { from: ZERO_ADDRESS, to: tokenOwner, tokenId }); expectEvent.inLogs(this.logs, 'Transfer', { from: ZERO_ADDRESS, to: owner, tokenId });
}); });
it('creates the token', async function () { it('creates the token', async function () {
expect(await this.token.balanceOf(tokenOwner)).to.be.bignumber.equal('1'); expect(await this.token.balanceOf(owner)).to.be.bignumber.equal('1');
expect(await this.token.ownerOf(tokenId)).to.equal(tokenOwner); expect(await this.token.ownerOf(tokenId)).to.equal(owner);
}); });
it('reverts when adding a token id that already exists', async function () { it('reverts when adding a token id that already exists', async function () {
await expectRevert(this.token.mint(tokenOwner, tokenId), 'ERC721: token already minted'); await expectRevert(this.token.mint(owner, tokenId), 'ERC721: token already minted');
}); });
}); });
}); });
...@@ -46,13 +46,13 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) { ...@@ -46,13 +46,13 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
describe('_burn(address, uint256)', function () { describe('_burn(address, uint256)', function () {
it('reverts when burning a non-existent token id', async function () { it('reverts when burning a non-existent token id', async function () {
await expectRevert( await expectRevert(
this.token.methods['burn(address,uint256)'](tokenOwner, tokenId), 'ERC721: owner query for nonexistent token' this.token.methods['burn(address,uint256)'](owner, tokenId), 'ERC721: owner query for nonexistent token'
); );
}); });
context('with minted token', function () { context('with minted token', function () {
beforeEach(async function () { beforeEach(async function () {
await this.token.mint(tokenOwner, tokenId); await this.token.mint(owner, tokenId);
}); });
it('reverts when the account is not the owner', async function () { it('reverts when the account is not the owner', async function () {
...@@ -63,15 +63,15 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) { ...@@ -63,15 +63,15 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
context('with burnt token', function () { context('with burnt token', function () {
beforeEach(async function () { beforeEach(async function () {
({ logs: this.logs } = await this.token.methods['burn(address,uint256)'](tokenOwner, tokenId)); ({ logs: this.logs } = await this.token.methods['burn(address,uint256)'](owner, tokenId));
}); });
it('emits a Transfer event', function () { it('emits a Transfer event', function () {
expectEvent.inLogs(this.logs, 'Transfer', { from: tokenOwner, to: ZERO_ADDRESS, tokenId }); expectEvent.inLogs(this.logs, 'Transfer', { from: owner, to: ZERO_ADDRESS, tokenId });
}); });
it('deletes the token', async function () { it('deletes the token', async function () {
expect(await this.token.balanceOf(tokenOwner)).to.be.bignumber.equal('0'); expect(await this.token.balanceOf(owner)).to.be.bignumber.equal('0');
await expectRevert( await expectRevert(
this.token.ownerOf(tokenId), 'ERC721: owner query for nonexistent token' this.token.ownerOf(tokenId), 'ERC721: owner query for nonexistent token'
); );
...@@ -79,7 +79,7 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) { ...@@ -79,7 +79,7 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
it('reverts when burning a token id that has been deleted', async function () { it('reverts when burning a token id that has been deleted', async function () {
await expectRevert( await expectRevert(
this.token.methods['burn(address,uint256)'](tokenOwner, tokenId), this.token.methods['burn(address,uint256)'](owner, tokenId),
'ERC721: owner query for nonexistent token' 'ERC721: owner query for nonexistent token'
); );
}); });
...@@ -96,7 +96,7 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) { ...@@ -96,7 +96,7 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
context('with minted token', function () { context('with minted token', function () {
beforeEach(async function () { beforeEach(async function () {
await this.token.mint(tokenOwner, tokenId); await this.token.mint(owner, tokenId);
}); });
context('with burnt token', function () { context('with burnt token', function () {
...@@ -105,11 +105,11 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) { ...@@ -105,11 +105,11 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
}); });
it('emits a Transfer event', function () { it('emits a Transfer event', function () {
expectEvent.inLogs(this.logs, 'Transfer', { from: tokenOwner, to: ZERO_ADDRESS, tokenId }); expectEvent.inLogs(this.logs, 'Transfer', { from: owner, to: ZERO_ADDRESS, tokenId });
}); });
it('deletes the token', async function () { it('deletes the token', async function () {
expect(await this.token.balanceOf(tokenOwner)).to.be.bignumber.equal('0'); expect(await this.token.balanceOf(owner)).to.be.bignumber.equal('0');
await expectRevert( await expectRevert(
this.token.ownerOf(tokenId), 'ERC721: owner query for nonexistent token' this.token.ownerOf(tokenId), 'ERC721: owner query for nonexistent token'
); );
......
...@@ -22,7 +22,7 @@ contract('ERC721Full', function ([ ...@@ -22,7 +22,7 @@ contract('ERC721Full', function ([
const [ const [
owner, owner,
newOwner, newOwner,
another, other,
] = accounts; ] = accounts;
beforeEach(async function () { beforeEach(async function () {
...@@ -143,21 +143,21 @@ contract('ERC721Full', function ([ ...@@ -143,21 +143,21 @@ contract('ERC721Full', function ([
describe('when the given address does not own any token', function () { describe('when the given address does not own any token', function () {
it('reverts', async function () { it('reverts', async function () {
await expectRevert( await expectRevert(
this.token.tokenOfOwnerByIndex(another, 0), 'ERC721Enumerable: owner index out of bounds' this.token.tokenOfOwnerByIndex(other, 0), 'ERC721Enumerable: owner index out of bounds'
); );
}); });
}); });
describe('after transferring all tokens to another user', function () { describe('after transferring all tokens to another user', function () {
beforeEach(async function () { beforeEach(async function () {
await this.token.transferFrom(owner, another, firstTokenId, { from: owner }); await this.token.transferFrom(owner, other, firstTokenId, { from: owner });
await this.token.transferFrom(owner, another, secondTokenId, { from: owner }); await this.token.transferFrom(owner, other, secondTokenId, { from: owner });
}); });
it('returns correct token IDs for target', async function () { it('returns correct token IDs for target', async function () {
expect(await this.token.balanceOf(another)).to.be.bignumber.equal('2'); expect(await this.token.balanceOf(other)).to.be.bignumber.equal('2');
const tokensListed = await Promise.all( const tokensListed = await Promise.all(
[0, 1].map(i => this.token.tokenOfOwnerByIndex(another, i)) [0, 1].map(i => this.token.tokenOfOwnerByIndex(other, i))
); );
expect(tokensListed.map(t => t.toNumber())).to.have.members([firstTokenId.toNumber(), expect(tokensListed.map(t => t.toNumber())).to.have.members([firstTokenId.toNumber(),
secondTokenId.toNumber()]); secondTokenId.toNumber()]);
......
...@@ -3,7 +3,7 @@ const { ZERO_ADDRESS } = constants; ...@@ -3,7 +3,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai'); const { expect } = require('chai');
function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) { function shouldBehaveLikeERC721PausedToken (owner, [receiver, operator]) {
const firstTokenId = new BN(1); const firstTokenId = new BN(1);
const mintedTokens = new BN(1); const mintedTokens = new BN(1);
const mockData = '0x42'; const mockData = '0x42';
...@@ -15,7 +15,7 @@ function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) { ...@@ -15,7 +15,7 @@ function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) {
it('reverts when trying to approve', async function () { it('reverts when trying to approve', async function () {
await expectRevert( await expectRevert(
this.token.approve(recipient, firstTokenId, { from: owner }), 'Pausable: paused' this.token.approve(receiver, firstTokenId, { from: owner }), 'Pausable: paused'
); );
}); });
...@@ -27,20 +27,20 @@ function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) { ...@@ -27,20 +27,20 @@ function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) {
it('reverts when trying to transferFrom', async function () { it('reverts when trying to transferFrom', async function () {
await expectRevert( await expectRevert(
this.token.transferFrom(owner, recipient, firstTokenId, { from: owner }), 'Pausable: paused' this.token.transferFrom(owner, receiver, firstTokenId, { from: owner }), 'Pausable: paused'
); );
}); });
it('reverts when trying to safeTransferFrom', async function () { it('reverts when trying to safeTransferFrom', async function () {
await expectRevert( await expectRevert(
this.token.safeTransferFrom(owner, recipient, firstTokenId, { from: owner }), 'Pausable: paused' this.token.safeTransferFrom(owner, receiver, firstTokenId, { from: owner }), 'Pausable: paused'
); );
}); });
it('reverts when trying to safeTransferFrom with data', async function () { it('reverts when trying to safeTransferFrom with data', async function () {
await expectRevert( await expectRevert(
this.token.methods['safeTransferFrom(address,address,uint256,bytes)']( this.token.methods['safeTransferFrom(address,address,uint256,bytes)'](
owner, recipient, firstTokenId, mockData, { from: owner } owner, receiver, firstTokenId, mockData, { from: owner }
), 'Pausable: paused' ), 'Pausable: paused'
); );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment