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
df0c2def
Commit
df0c2def
authored
Oct 26, 2016
by
Makoto Inoue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restructure test
parent
14b84962
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
30 deletions
+39
-30
Bounty.js
test/Bounty.js
+39
-30
No files found.
test/Bounty.js
View file @
df0c2def
contract
(
'Bounty'
,
function
(
accounts
)
{
it
(
"can create bounty contract with factory address"
,
function
(
done
){
var
target
=
SecureTargetMock
.
deployed
();
SimpleTokenBounty
.
new
(
target
.
address
).
then
(
function
(
bounty
){
return
bounty
.
factoryAddress
.
call
()
...
...
@@ -11,37 +12,45 @@ contract('Bounty', function(accounts) {
then
(
done
);
})
it
(
"can call checkInvariant for SecureTargetMock"
,
function
(
done
){
var
bounty
;
var
targetFactory
=
SecureTargetFactory
.
deployed
();
SimpleTokenBounty
.
new
(
targetFactory
.
address
).
then
(
function
(
_bounty
)
{
bounty
=
_bounty
;
return
bounty
.
createTarget
();
}).
then
(
function
()
{
return
bounty
.
checkInvariant
.
call
()
}).
then
(
function
(
result
)
{
assert
.
isTrue
(
result
);
}).
then
(
done
);
describe
(
"SecureTargetMock"
,
function
(){
before
(
function
(){
targetFactory
=
SecureTargetFactory
.
deployed
();
})
it
(
"checkInvariant returns true"
,
function
(
done
){
SimpleTokenBounty
.
new
(
targetFactory
.
address
).
then
(
function
(
_bounty
)
{
bounty
=
_bounty
;
return
bounty
.
createTarget
();
}).
then
(
function
()
{
return
bounty
.
checkInvariant
.
call
()
}).
then
(
function
(
result
)
{
assert
.
isTrue
(
result
);
}).
then
(
done
);
})
})
it
(
"can call checkInvariant for InsecureTargetMock"
,
function
(
done
){
var
bounty
;
var
targetFactory
=
InsecureTargetFactory
.
deployed
();
SimpleTokenBounty
.
new
(
targetFactory
.
address
).
then
(
function
(
_bounty
)
{
bounty
=
_bounty
;
return
bounty
.
createTarget
();
}).
then
(
function
()
{
return
bounty
.
checkInvariant
.
call
()
}).
then
(
function
(
result
)
{
assert
.
isFalse
(
result
);
}).
then
(
done
);
describe
(
"InsecureTargetMock"
,
function
(){
before
(
function
(){
targetFactory
=
InsecureTargetFactory
.
deployed
();
})
it
(
"checkInvariant returns false"
,
function
(
done
){
SimpleTokenBounty
.
new
(
targetFactory
.
address
).
then
(
function
(
_bounty
)
{
bounty
=
_bounty
;
return
bounty
.
createTarget
();
}).
then
(
function
()
{
return
bounty
.
checkInvariant
.
call
()
}).
then
(
function
(
result
)
{
assert
.
isFalse
(
result
);
}).
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