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
a156064b
Commit
a156064b
authored
Nov 13, 2016
by
Steve Ellis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make claimable use fresh instances for each test
parent
1547000d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
18 deletions
+29
-18
Claimable.js
test/Claimable.js
+29
-18
No files found.
test/Claimable.js
View file @
a156064b
contract
(
'Claimable'
,
function
(
accounts
)
{
contract
(
'Claimable'
,
function
(
accounts
)
{
var
claimable
;
beforeEach
(
function
()
{
return
Claimable
.
new
().
then
(
function
(
deployed
)
{
claimable
=
deployed
;
});
});
it
(
"should have an owner"
,
function
(
done
)
{
it
(
"should have an owner"
,
function
(
done
)
{
var
claimable
=
Claimable
.
deployed
();
return
claimable
.
owner
()
return
claimable
.
owner
()
.
then
(
function
(
owner
)
{
.
then
(
function
(
owner
)
{
assert
.
isTrue
(
owner
!=
0
);
assert
.
isTrue
(
owner
!=
0
);
...
@@ -10,19 +16,18 @@ contract('Claimable', function(accounts) {
...
@@ -10,19 +16,18 @@ contract('Claimable', function(accounts) {
});
});
it
(
"changes pendingOwner after transfer"
,
function
(
done
)
{
it
(
"changes pendingOwner after transfer"
,
function
(
done
)
{
var
claimable
=
Claimable
.
deployed
()
;
var
newOwner
=
accounts
[
1
]
;
return
claimable
.
transfer
(
accounts
[
1
]
)
return
claimable
.
transfer
(
newOwner
)
.
then
(
function
()
{
.
then
(
function
()
{
return
claimable
.
pendingOwner
();
return
claimable
.
pendingOwner
();
})
})
.
then
(
function
(
pendingOwner
)
{
.
then
(
function
(
pendingOwner
)
{
assert
.
isTrue
(
pendingOwner
===
accounts
[
1
]
);
assert
.
isTrue
(
pendingOwner
===
newOwner
);
})
})
.
then
(
done
)
.
then
(
done
)
});
});
it
(
"should prevent to claimOwnership from no pendingOwner"
,
function
(
done
)
{
it
(
"should prevent to claimOwnership from no pendingOwner"
,
function
(
done
)
{
var
claimable
=
Claimable
.
deployed
();
return
claimable
.
claimOwnership
({
from
:
accounts
[
2
]})
return
claimable
.
claimOwnership
({
from
:
accounts
[
2
]})
.
then
(
function
()
{
.
then
(
function
()
{
return
claimable
.
owner
();
return
claimable
.
owner
();
...
@@ -33,20 +38,7 @@ contract('Claimable', function(accounts) {
...
@@ -33,20 +38,7 @@ contract('Claimable', function(accounts) {
.
then
(
done
)
.
then
(
done
)
});
});
it
(
"changes allow pending owner to claim ownership"
,
function
(
done
)
{
var
claimable
=
Claimable
.
deployed
();
return
claimable
.
claimOwnership
({
from
:
accounts
[
1
]})
.
then
(
function
()
{
return
claimable
.
owner
();
})
.
then
(
function
(
owner
)
{
assert
.
isTrue
(
owner
===
accounts
[
1
]);
})
.
then
(
done
)
});
it
(
"should prevent non-owners from transfering"
,
function
(
done
)
{
it
(
"should prevent non-owners from transfering"
,
function
(
done
)
{
var
claimable
=
Claimable
.
deployed
();
return
claimable
.
transfer
(
accounts
[
2
],
{
from
:
accounts
[
2
]})
return
claimable
.
transfer
(
accounts
[
2
],
{
from
:
accounts
[
2
]})
.
then
(
function
()
{
.
then
(
function
()
{
return
claimable
.
pendingOwner
();
return
claimable
.
pendingOwner
();
...
@@ -57,4 +49,23 @@ contract('Claimable', function(accounts) {
...
@@ -57,4 +49,23 @@ contract('Claimable', function(accounts) {
.
then
(
done
)
.
then
(
done
)
});
});
describe
(
"after initiating a transfer"
,
function
()
{
var
newOwner
;
beforeEach
(
function
()
{
newOwner
=
accounts
[
1
];
return
claimable
.
transfer
(
newOwner
);
});
it
(
"changes allow pending owner to claim ownership"
,
function
(
done
)
{
return
claimable
.
claimOwnership
({
from
:
newOwner
})
.
then
(
function
()
{
return
claimable
.
owner
();
})
.
then
(
function
(
owner
)
{
assert
.
isTrue
(
owner
===
newOwner
);
})
.
then
(
done
)
});
});
});
});
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