|
|
@ -1,7 +1,6 @@ |
|
|
|
const { assertRevert } = require('../../helpers/assertRevert'); |
|
|
|
const { assertRevert } = require('../../helpers/assertRevert'); |
|
|
|
const { shouldBehaveLikeERC721 } = require('./ERC721.behavior'); |
|
|
|
const { shouldBehaveLikeERC721 } = require('./ERC721.behavior'); |
|
|
|
const { shouldSupportInterfaces } = require('../../introspection/SupportsInterface.behavior'); |
|
|
|
const { shouldSupportInterfaces } = require('../../introspection/SupportsInterface.behavior'); |
|
|
|
const _ = require('lodash'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const BigNumber = web3.BigNumber; |
|
|
|
const BigNumber = web3.BigNumber; |
|
|
|
const ERC721FullMock = artifacts.require('ERC721FullMock.sol'); |
|
|
|
const ERC721FullMock = artifacts.require('ERC721FullMock.sol'); |
|
|
@ -172,7 +171,9 @@ contract('ERC721Full', function ([ |
|
|
|
|
|
|
|
|
|
|
|
it('returns correct token IDs for target', async function () { |
|
|
|
it('returns correct token IDs for target', async function () { |
|
|
|
(await this.token.balanceOf(another)).toNumber().should.be.equal(2); |
|
|
|
(await this.token.balanceOf(another)).toNumber().should.be.equal(2); |
|
|
|
const tokensListed = await Promise.all(_.range(2).map(i => this.token.tokenOfOwnerByIndex(another, i))); |
|
|
|
const tokensListed = await Promise.all( |
|
|
|
|
|
|
|
[0, 1].map(i => this.token.tokenOfOwnerByIndex(another, i)) |
|
|
|
|
|
|
|
); |
|
|
|
tokensListed.map(t => t.toNumber()).should.have.members([firstTokenId, secondTokenId]); |
|
|
|
tokensListed.map(t => t.toNumber()).should.have.members([firstTokenId, secondTokenId]); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -185,7 +186,9 @@ contract('ERC721Full', function ([ |
|
|
|
|
|
|
|
|
|
|
|
describe('tokenByIndex', function () { |
|
|
|
describe('tokenByIndex', function () { |
|
|
|
it('should return all tokens', async function () { |
|
|
|
it('should return all tokens', async function () { |
|
|
|
const tokensListed = await Promise.all(_.range(2).map(i => this.token.tokenByIndex(i))); |
|
|
|
const tokensListed = await Promise.all( |
|
|
|
|
|
|
|
[0, 1].map(i => this.token.tokenByIndex(i)) |
|
|
|
|
|
|
|
); |
|
|
|
tokensListed.map(t => t.toNumber()).should.have.members([firstTokenId, secondTokenId]); |
|
|
|
tokensListed.map(t => t.toNumber()).should.have.members([firstTokenId, secondTokenId]); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -204,9 +207,10 @@ contract('ERC721Full', function ([ |
|
|
|
|
|
|
|
|
|
|
|
(await this.token.totalSupply()).toNumber().should.be.equal(3); |
|
|
|
(await this.token.totalSupply()).toNumber().should.be.equal(3); |
|
|
|
|
|
|
|
|
|
|
|
const tokensListed = await Promise.all(_.range(3).map(i => this.token.tokenByIndex(i))); |
|
|
|
const tokensListed = await Promise.all( |
|
|
|
const expectedTokens = _.filter( |
|
|
|
[0, 1, 2].map(i => this.token.tokenByIndex(i)) |
|
|
|
[firstTokenId, secondTokenId, newTokenId, anotherNewTokenId], |
|
|
|
); |
|
|
|
|
|
|
|
const expectedTokens = [firstTokenId, secondTokenId, newTokenId, anotherNewTokenId].filter( |
|
|
|
x => (x !== tokenId) |
|
|
|
x => (x !== tokenId) |
|
|
|
); |
|
|
|
); |
|
|
|
tokensListed.map(t => t.toNumber()).should.have.members(expectedTokens); |
|
|
|
tokensListed.map(t => t.toNumber()).should.have.members(expectedTokens); |
|
|
|