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
ba0fd11f
Commit
ba0fd11f
authored
Aug 27, 2019
by
Jatin Kathuria
Committed by
Nicolás Venturo
Aug 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed symbols as as a part of Issue#1148 (#1891)
parent
635a3814
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
26 deletions
+26
-26
git
git
+0
-0
ERC721.test.js
test/token/ERC721/ERC721.test.js
+15
-15
ERC721Full.test.js
test/token/ERC721/ERC721Full.test.js
+6
-6
ERC721PausedToken.behavior.js
test/token/ERC721/ERC721PausedToken.behavior.js
+5
-5
No files found.
git
0 → 100644
View file @
ba0fd11f
test/token/ERC721/ERC721.test.js
View file @
ba0fd11f
...
...
@@ -6,7 +6,7 @@ const { expect } = require('chai');
const
{
shouldBehaveLikeERC721
}
=
require
(
'./ERC721.behavior'
);
const
ERC721Mock
=
artifacts
.
require
(
'ERC721Mock.sol'
);
contract
(
'ERC721'
,
function
([
_
,
creator
,
tokenO
wner
,
other
,
...
accounts
])
{
contract
(
'ERC721'
,
function
([
_
,
creator
,
o
wner
,
other
,
...
accounts
])
{
beforeEach
(
async
function
()
{
this
.
token
=
await
ERC721Mock
.
new
({
from
:
creator
});
});
...
...
@@ -25,20 +25,20 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
context
(
'with minted token'
,
async
function
()
{
beforeEach
(
async
function
()
{
({
logs
:
this
.
logs
}
=
await
this
.
token
.
mint
(
tokenO
wner
,
tokenId
));
({
logs
:
this
.
logs
}
=
await
this
.
token
.
mint
(
o
wner
,
tokenId
));
});
it
(
'emits a Transfer event'
,
function
()
{
expectEvent
.
inLogs
(
this
.
logs
,
'Transfer'
,
{
from
:
ZERO_ADDRESS
,
to
:
tokenO
wner
,
tokenId
});
expectEvent
.
inLogs
(
this
.
logs
,
'Transfer'
,
{
from
:
ZERO_ADDRESS
,
to
:
o
wner
,
tokenId
});
});
it
(
'creates the token'
,
async
function
()
{
expect
(
await
this
.
token
.
balanceOf
(
tokenO
wner
)).
to
.
be
.
bignumber
.
equal
(
'1'
);
expect
(
await
this
.
token
.
ownerOf
(
tokenId
)).
to
.
equal
(
tokenO
wner
);
expect
(
await
this
.
token
.
balanceOf
(
o
wner
)).
to
.
be
.
bignumber
.
equal
(
'1'
);
expect
(
await
this
.
token
.
ownerOf
(
tokenId
)).
to
.
equal
(
o
wner
);
});
it
(
'reverts when adding a token id that already exists'
,
async
function
()
{
await
expectRevert
(
this
.
token
.
mint
(
tokenO
wner
,
tokenId
),
'ERC721: token already minted'
);
await
expectRevert
(
this
.
token
.
mint
(
o
wner
,
tokenId
),
'ERC721: token already minted'
);
});
});
});
...
...
@@ -46,13 +46,13 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
describe
(
'_burn(address, uint256)'
,
function
()
{
it
(
'reverts when burning a non-existent token id'
,
async
function
()
{
await
expectRevert
(
this
.
token
.
methods
[
'burn(address,uint256)'
](
tokenO
wner
,
tokenId
),
'ERC721: owner query for nonexistent token'
this
.
token
.
methods
[
'burn(address,uint256)'
](
o
wner
,
tokenId
),
'ERC721: owner query for nonexistent token'
);
});
context
(
'with minted token'
,
function
()
{
beforeEach
(
async
function
()
{
await
this
.
token
.
mint
(
tokenO
wner
,
tokenId
);
await
this
.
token
.
mint
(
o
wner
,
tokenId
);
});
it
(
'reverts when the account is not the owner'
,
async
function
()
{
...
...
@@ -63,15 +63,15 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
context
(
'with burnt token'
,
function
()
{
beforeEach
(
async
function
()
{
({
logs
:
this
.
logs
}
=
await
this
.
token
.
methods
[
'burn(address,uint256)'
](
tokenO
wner
,
tokenId
));
({
logs
:
this
.
logs
}
=
await
this
.
token
.
methods
[
'burn(address,uint256)'
](
o
wner
,
tokenId
));
});
it
(
'emits a Transfer event'
,
function
()
{
expectEvent
.
inLogs
(
this
.
logs
,
'Transfer'
,
{
from
:
tokenO
wner
,
to
:
ZERO_ADDRESS
,
tokenId
});
expectEvent
.
inLogs
(
this
.
logs
,
'Transfer'
,
{
from
:
o
wner
,
to
:
ZERO_ADDRESS
,
tokenId
});
});
it
(
'deletes the token'
,
async
function
()
{
expect
(
await
this
.
token
.
balanceOf
(
tokenO
wner
)).
to
.
be
.
bignumber
.
equal
(
'0'
);
expect
(
await
this
.
token
.
balanceOf
(
o
wner
)).
to
.
be
.
bignumber
.
equal
(
'0'
);
await
expectRevert
(
this
.
token
.
ownerOf
(
tokenId
),
'ERC721: owner query for nonexistent token'
);
...
...
@@ -79,7 +79,7 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
it
(
'reverts when burning a token id that has been deleted'
,
async
function
()
{
await
expectRevert
(
this
.
token
.
methods
[
'burn(address,uint256)'
](
tokenO
wner
,
tokenId
),
this
.
token
.
methods
[
'burn(address,uint256)'
](
o
wner
,
tokenId
),
'ERC721: owner query for nonexistent token'
);
});
...
...
@@ -96,7 +96,7 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
context
(
'with minted token'
,
function
()
{
beforeEach
(
async
function
()
{
await
this
.
token
.
mint
(
tokenO
wner
,
tokenId
);
await
this
.
token
.
mint
(
o
wner
,
tokenId
);
});
context
(
'with burnt token'
,
function
()
{
...
...
@@ -105,11 +105,11 @@ contract('ERC721', function ([_, creator, tokenOwner, other, ...accounts]) {
});
it
(
'emits a Transfer event'
,
function
()
{
expectEvent
.
inLogs
(
this
.
logs
,
'Transfer'
,
{
from
:
tokenO
wner
,
to
:
ZERO_ADDRESS
,
tokenId
});
expectEvent
.
inLogs
(
this
.
logs
,
'Transfer'
,
{
from
:
o
wner
,
to
:
ZERO_ADDRESS
,
tokenId
});
});
it
(
'deletes the token'
,
async
function
()
{
expect
(
await
this
.
token
.
balanceOf
(
tokenO
wner
)).
to
.
be
.
bignumber
.
equal
(
'0'
);
expect
(
await
this
.
token
.
balanceOf
(
o
wner
)).
to
.
be
.
bignumber
.
equal
(
'0'
);
await
expectRevert
(
this
.
token
.
ownerOf
(
tokenId
),
'ERC721: owner query for nonexistent token'
);
...
...
test/token/ERC721/ERC721Full.test.js
View file @
ba0fd11f
...
...
@@ -22,7 +22,7 @@ contract('ERC721Full', function ([
const
[
owner
,
newOwner
,
an
other
,
other
,
]
=
accounts
;
beforeEach
(
async
function
()
{
...
...
@@ -143,21 +143,21 @@ contract('ERC721Full', function ([
describe
(
'when the given address does not own any token'
,
function
()
{
it
(
'reverts'
,
async
function
()
{
await
expectRevert
(
this
.
token
.
tokenOfOwnerByIndex
(
an
other
,
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
()
{
beforeEach
(
async
function
()
{
await
this
.
token
.
transferFrom
(
owner
,
an
other
,
firstTokenId
,
{
from
:
owner
});
await
this
.
token
.
transferFrom
(
owner
,
an
other
,
secondTokenId
,
{
from
:
owner
});
await
this
.
token
.
transferFrom
(
owner
,
other
,
firstTokenId
,
{
from
:
owner
});
await
this
.
token
.
transferFrom
(
owner
,
other
,
secondTokenId
,
{
from
:
owner
});
});
it
(
'returns correct token IDs for target'
,
async
function
()
{
expect
(
await
this
.
token
.
balanceOf
(
an
other
)).
to
.
be
.
bignumber
.
equal
(
'2'
);
expect
(
await
this
.
token
.
balanceOf
(
other
)).
to
.
be
.
bignumber
.
equal
(
'2'
);
const
tokensListed
=
await
Promise
.
all
(
[
0
,
1
].
map
(
i
=>
this
.
token
.
tokenOfOwnerByIndex
(
an
other
,
i
))
[
0
,
1
].
map
(
i
=>
this
.
token
.
tokenOfOwnerByIndex
(
other
,
i
))
);
expect
(
tokensListed
.
map
(
t
=>
t
.
toNumber
())).
to
.
have
.
members
([
firstTokenId
.
toNumber
(),
secondTokenId
.
toNumber
()]);
...
...
test/token/ERC721/ERC721PausedToken.behavior.js
View file @
ba0fd11f
...
...
@@ -3,7 +3,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
function
shouldBehaveLikeERC721PausedToken
(
owner
,
[
rec
ipient
,
operator
])
{
function
shouldBehaveLikeERC721PausedToken
(
owner
,
[
rec
eiver
,
operator
])
{
const
firstTokenId
=
new
BN
(
1
);
const
mintedTokens
=
new
BN
(
1
);
const
mockData
=
'0x42'
;
...
...
@@ -15,7 +15,7 @@ function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) {
it
(
'reverts when trying to approve'
,
async
function
()
{
await
expectRevert
(
this
.
token
.
approve
(
rec
ipient
,
firstTokenId
,
{
from
:
owner
}),
'Pausable: paused'
this
.
token
.
approve
(
rec
eiver
,
firstTokenId
,
{
from
:
owner
}),
'Pausable: paused'
);
});
...
...
@@ -27,20 +27,20 @@ function shouldBehaveLikeERC721PausedToken (owner, [recipient, operator]) {
it
(
'reverts when trying to transferFrom'
,
async
function
()
{
await
expectRevert
(
this
.
token
.
transferFrom
(
owner
,
rec
ipient
,
firstTokenId
,
{
from
:
owner
}),
'Pausable: paused'
this
.
token
.
transferFrom
(
owner
,
rec
eiver
,
firstTokenId
,
{
from
:
owner
}),
'Pausable: paused'
);
});
it
(
'reverts when trying to safeTransferFrom'
,
async
function
()
{
await
expectRevert
(
this
.
token
.
safeTransferFrom
(
owner
,
rec
ipient
,
firstTokenId
,
{
from
:
owner
}),
'Pausable: paused'
this
.
token
.
safeTransferFrom
(
owner
,
rec
eiver
,
firstTokenId
,
{
from
:
owner
}),
'Pausable: paused'
);
});
it
(
'reverts when trying to safeTransferFrom with data'
,
async
function
()
{
await
expectRevert
(
this
.
token
.
methods
[
'safeTransferFrom(address,address,uint256,bytes)'
](
owner
,
rec
ipient
,
firstTokenId
,
mockData
,
{
from
:
owner
}
owner
,
rec
eiver
,
firstTokenId
,
mockData
,
{
from
:
owner
}
),
'Pausable: paused'
);
});
...
...
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