Skip to content

Commit d062352

Browse files
exemplarovfrangio
authored andcommitted
Remove lodash from tests (#1323)
1 parent b4f87bb commit d062352

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

test/helpers/sendTransaction.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
const _ = require('lodash');
21
const ethjsABI = require('ethjs-abi');
32

43
function findMethod (abi, name, args) {
54
for (let i = 0; i < abi.length; i++) {
6-
const methodArgs = _.map(abi[i].inputs, 'type').join(',');
5+
const methodArgs = abi[i].inputs.map(input => input.type).join(',');
76
if ((abi[i].name === name) && (methodArgs === args)) {
87
return abi[i];
98
}

test/token/ERC721/ERC721.behavior.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const { shouldSupportInterfaces } = require('../../introspection/SupportsInterfa
22
const { assertRevert } = require('../../helpers/assertRevert');
33
const { decodeLogs } = require('../../helpers/decodeLogs');
44
const { sendTransaction } = require('../../helpers/sendTransaction');
5-
const _ = require('lodash');
65

76
const ERC721Receiver = artifacts.require('ERC721ReceiverMock.sol');
87
const BigNumber = web3.BigNumber;
@@ -175,7 +174,9 @@ function shouldBehaveLikeERC721 (
175174

176175
it('keeps same tokens by index', async function () {
177176
if (!this.token.tokenOfOwnerByIndex) return;
178-
const tokensListed = await Promise.all(_.range(2).map(i => this.token.tokenOfOwnerByIndex(owner, i)));
177+
const tokensListed = await Promise.all(
178+
[0, 1].map(i => this.token.tokenOfOwnerByIndex(owner, i))
179+
);
179180
tokensListed.map(t => t.toNumber()).should.have.members([firstTokenId, secondTokenId]);
180181
});
181182
});

test/token/ERC721/ERC721Full.test.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const { assertRevert } = require('../../helpers/assertRevert');
22
const { shouldBehaveLikeERC721 } = require('./ERC721.behavior');
33
const { shouldBehaveLikeMintAndBurnERC721 } = require('./ERC721MintBurn.behavior');
44
const { shouldSupportInterfaces } = require('../../introspection/SupportsInterface.behavior');
5-
const _ = require('lodash');
65

76
const BigNumber = web3.BigNumber;
87
const ERC721FullMock = artifacts.require('ERC721FullMock.sol');
@@ -173,7 +172,9 @@ contract('ERC721Full', function ([
173172

174173
it('returns correct token IDs for target', async function () {
175174
(await this.token.balanceOf(another)).toNumber().should.be.equal(2);
176-
const tokensListed = await Promise.all(_.range(2).map(i => this.token.tokenOfOwnerByIndex(another, i)));
175+
const tokensListed = await Promise.all(
176+
[0, 1].map(i => this.token.tokenOfOwnerByIndex(another, i))
177+
);
177178
tokensListed.map(t => t.toNumber()).should.have.members([firstTokenId, secondTokenId]);
178179
});
179180

@@ -186,7 +187,9 @@ contract('ERC721Full', function ([
186187

187188
describe('tokenByIndex', function () {
188189
it('should return all tokens', async function () {
189-
const tokensListed = await Promise.all(_.range(2).map(i => this.token.tokenByIndex(i)));
190+
const tokensListed = await Promise.all(
191+
[0, 1].map(i => this.token.tokenByIndex(i))
192+
);
190193
tokensListed.map(t => t.toNumber()).should.have.members([firstTokenId, secondTokenId]);
191194
});
192195

@@ -205,9 +208,10 @@ contract('ERC721Full', function ([
205208

206209
(await this.token.totalSupply()).toNumber().should.be.equal(3);
207210

208-
const tokensListed = await Promise.all(_.range(3).map(i => this.token.tokenByIndex(i)));
209-
const expectedTokens = _.filter(
210-
[firstTokenId, secondTokenId, newTokenId, anotherNewTokenId],
211+
const tokensListed = await Promise.all(
212+
[0, 1, 2].map(i => this.token.tokenByIndex(i))
213+
);
214+
const expectedTokens = [firstTokenId, secondTokenId, newTokenId, anotherNewTokenId].filter(
211215
x => (x !== tokenId)
212216
);
213217
tokensListed.map(t => t.toNumber()).should.have.members(expectedTokens);

0 commit comments

Comments
 (0)