Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
d062352d
Commit
d062352d
authored
Sep 17, 2018
by
Roman Exempliarov
Committed by
Francisco Giordano
Sep 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove lodash from tests (#1323)
parent
b4f87bb8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
10 deletions
+14
-10
sendTransaction.js
test/helpers/sendTransaction.js
+1
-2
ERC721.behavior.js
test/token/ERC721/ERC721.behavior.js
+3
-2
ERC721Full.test.js
test/token/ERC721/ERC721Full.test.js
+10
-6
No files found.
test/helpers/sendTransaction.js
View file @
d062352d
const
_
=
require
(
'lodash'
);
const
ethjsABI
=
require
(
'ethjs-abi'
);
const
ethjsABI
=
require
(
'ethjs-abi'
);
function
findMethod
(
abi
,
name
,
args
)
{
function
findMethod
(
abi
,
name
,
args
)
{
for
(
let
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
const
methodArgs
=
_
.
map
(
abi
[
i
].
inputs
,
'type'
).
join
(
','
);
const
methodArgs
=
abi
[
i
].
inputs
.
map
(
input
=>
input
.
type
).
join
(
','
);
if
((
abi
[
i
].
name
===
name
)
&&
(
methodArgs
===
args
))
{
if
((
abi
[
i
].
name
===
name
)
&&
(
methodArgs
===
args
))
{
return
abi
[
i
];
return
abi
[
i
];
}
}
...
...
test/token/ERC721/ERC721.behavior.js
View file @
d062352d
...
@@ -2,7 +2,6 @@ const { shouldSupportInterfaces } = require('../../introspection/SupportsInterfa
...
@@ -2,7 +2,6 @@ const { shouldSupportInterfaces } = require('../../introspection/SupportsInterfa
const
{
assertRevert
}
=
require
(
'../../helpers/assertRevert'
);
const
{
assertRevert
}
=
require
(
'../../helpers/assertRevert'
);
const
{
decodeLogs
}
=
require
(
'../../helpers/decodeLogs'
);
const
{
decodeLogs
}
=
require
(
'../../helpers/decodeLogs'
);
const
{
sendTransaction
}
=
require
(
'../../helpers/sendTransaction'
);
const
{
sendTransaction
}
=
require
(
'../../helpers/sendTransaction'
);
const
_
=
require
(
'lodash'
);
const
ERC721Receiver
=
artifacts
.
require
(
'ERC721ReceiverMock.sol'
);
const
ERC721Receiver
=
artifacts
.
require
(
'ERC721ReceiverMock.sol'
);
const
BigNumber
=
web3
.
BigNumber
;
const
BigNumber
=
web3
.
BigNumber
;
...
@@ -175,7 +174,9 @@ function shouldBehaveLikeERC721 (
...
@@ -175,7 +174,9 @@ function shouldBehaveLikeERC721 (
it
(
'keeps same tokens by index'
,
async
function
()
{
it
(
'keeps same tokens by index'
,
async
function
()
{
if
(
!
this
.
token
.
tokenOfOwnerByIndex
)
return
;
if
(
!
this
.
token
.
tokenOfOwnerByIndex
)
return
;
const
tokensListed
=
await
Promise
.
all
(
_
.
range
(
2
).
map
(
i
=>
this
.
token
.
tokenOfOwnerByIndex
(
owner
,
i
)));
const
tokensListed
=
await
Promise
.
all
(
[
0
,
1
].
map
(
i
=>
this
.
token
.
tokenOfOwnerByIndex
(
owner
,
i
))
);
tokensListed
.
map
(
t
=>
t
.
toNumber
()).
should
.
have
.
members
([
firstTokenId
,
secondTokenId
]);
tokensListed
.
map
(
t
=>
t
.
toNumber
()).
should
.
have
.
members
([
firstTokenId
,
secondTokenId
]);
});
});
});
});
...
...
test/token/ERC721/ERC721Full.test.js
View file @
d062352d
...
@@ -2,7 +2,6 @@ const { assertRevert } = require('../../helpers/assertRevert');
...
@@ -2,7 +2,6 @@ const { assertRevert } = require('../../helpers/assertRevert');
const
{
shouldBehaveLikeERC721
}
=
require
(
'./ERC721.behavior'
);
const
{
shouldBehaveLikeERC721
}
=
require
(
'./ERC721.behavior'
);
const
{
shouldBehaveLikeMintAndBurnERC721
}
=
require
(
'./ERC721MintBurn.behavior'
);
const
{
shouldBehaveLikeMintAndBurnERC721
}
=
require
(
'./ERC721MintBurn.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'
);
...
@@ -173,7 +172,9 @@ contract('ERC721Full', function ([
...
@@ -173,7 +172,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
]);
});
});
...
@@ -186,7 +187,9 @@ contract('ERC721Full', function ([
...
@@ -186,7 +187,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
]);
});
});
...
@@ -205,9 +208,10 @@ contract('ERC721Full', function ([
...
@@ -205,9 +208,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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment