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
d7b38038
Commit
d7b38038
authored
Nov 14, 2016
by
Manuel Aráoz
Committed by
GitHub
Nov 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #67 from se3000/fresh_fixtures
Move away from migration fixtures in tests
parents
a3362f72
a156064b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
21 deletions
+37
-21
Claimable.js
test/Claimable.js
+29
-18
Ownable.js
test/Ownable.js
+8
-3
No files found.
test/Claimable.js
View file @
d7b38038
contract
(
'Claimable'
,
function
(
accounts
)
{
var
claimable
;
beforeEach
(
function
()
{
return
Claimable
.
new
().
then
(
function
(
deployed
)
{
claimable
=
deployed
;
});
});
it
(
"should have an owner"
,
function
(
done
)
{
var
claimable
=
Claimable
.
deployed
();
return
claimable
.
owner
()
.
then
(
function
(
owner
)
{
assert
.
isTrue
(
owner
!=
0
);
...
...
@@ -10,19 +16,18 @@ contract('Claimable', function(accounts) {
});
it
(
"changes pendingOwner after transfer"
,
function
(
done
)
{
var
claimable
=
Claimable
.
deployed
()
;
return
claimable
.
transfer
(
accounts
[
1
]
)
var
newOwner
=
accounts
[
1
]
;
return
claimable
.
transfer
(
newOwner
)
.
then
(
function
()
{
return
claimable
.
pendingOwner
();
})
.
then
(
function
(
pendingOwner
)
{
assert
.
isTrue
(
pendingOwner
===
accounts
[
1
]
);
assert
.
isTrue
(
pendingOwner
===
newOwner
);
})
.
then
(
done
)
});
it
(
"should prevent to claimOwnership from no pendingOwner"
,
function
(
done
)
{
var
claimable
=
Claimable
.
deployed
();
return
claimable
.
claimOwnership
({
from
:
accounts
[
2
]})
.
then
(
function
()
{
return
claimable
.
owner
();
...
...
@@ -33,20 +38,7 @@ contract('Claimable', function(accounts) {
.
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
)
{
var
claimable
=
Claimable
.
deployed
();
return
claimable
.
transfer
(
accounts
[
2
],
{
from
:
accounts
[
2
]})
.
then
(
function
()
{
return
claimable
.
pendingOwner
();
...
...
@@ -57,4 +49,23 @@ contract('Claimable', function(accounts) {
.
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
)
});
});
});
test/Ownable.js
View file @
d7b38038
contract
(
'Ownable'
,
function
(
accounts
)
{
var
ownable
;
beforeEach
(
function
()
{
return
Ownable
.
new
().
then
(
function
(
deployed
)
{
ownable
=
deployed
;
});
});
it
(
"should have an owner"
,
function
(
done
)
{
var
ownable
=
Ownable
.
deployed
();
return
ownable
.
owner
()
.
then
(
function
(
owner
)
{
assert
.
isTrue
(
owner
!=
0
);
...
...
@@ -9,7 +16,6 @@ contract('Ownable', function(accounts) {
});
it
(
"changes owner after transfer"
,
function
(
done
)
{
var
ownable
=
Ownable
.
deployed
();
var
other
=
accounts
[
1
];
return
ownable
.
transfer
(
other
)
.
then
(
function
()
{
...
...
@@ -22,7 +28,6 @@ contract('Ownable', function(accounts) {
});
it
(
"should prevent non-owners from transfering"
,
function
(
done
)
{
var
ownable
=
Ownable
.
deployed
();
var
other
=
accounts
[
2
];
return
ownable
.
transfer
(
other
,
{
from
:
accounts
[
2
]})
.
then
(
function
()
{
...
...
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