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
fe712c67
Commit
fe712c67
authored
Nov 30, 2017
by
zava
Committed by
Alejandro Santander
Jan 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SimpleSavingsWallet.js] replace assertJump for expectThrow
parent
c70ee937
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
22 deletions
+5
-22
SimpleSavingsWallet.js
test/SimpleSavingsWallet.js
+5
-22
No files found.
test/SimpleSavingsWallet.js
View file @
fe712c67
'use strict'
'use strict'
import
assertJump
from
'./helpers/assertJump'
import
expectThrow
from
'./helpers/expectThrow'
;
const
SimpleSavingsWallet
=
artifacts
.
require
(
'../contracts/examples/SimpleSavingsWallet.sol'
)
const
SimpleSavingsWallet
=
artifacts
.
require
(
'../contracts/examples/SimpleSavingsWallet.sol'
)
...
@@ -24,29 +24,12 @@ contract('SimpleSavingsWallet', function(accounts) {
...
@@ -24,29 +24,12 @@ contract('SimpleSavingsWallet', function(accounts) {
it
(
'owner can send funds'
,
async
function
()
{
it
(
'owner can send funds'
,
async
function
()
{
// Receive payment so we have some money to spend.
// Receive payment so we have some money to spend.
await
web3
.
eth
.
sendTransaction
({
from
:
accounts
[
9
],
to
:
savingsWallet
.
address
,
value
:
1000000
})
await
web3
.
eth
.
sendTransaction
({
from
:
accounts
[
9
],
to
:
savingsWallet
.
address
,
value
:
1000000
})
try
{
await
expectThrow
(
savingsWallet
.
sendTo
(
0
,
paymentAmount
,
{
from
:
owner
}))
await
savingsWallet
.
sendTo
(
0
,
paymentAmount
,
{
from
:
owner
})
await
expectThrow
(
savingsWallet
.
sendTo
(
savingsWallet
.
address
,
paymentAmount
,
{
from
:
owner
}))
assert
.
fail
(
'should have thrown before'
)
await
expectThrow
(
savingsWallet
.
sendTo
(
accounts
[
1
],
0
,
{
from
:
owner
}))
}
catch
(
error
)
{
assertJump
(
error
)
}
try
{
await
savingsWallet
.
sendTo
(
savingsWallet
.
address
,
paymentAmount
,
{
from
:
owner
})
assert
.
fail
(
'should have thrown before'
)
}
catch
(
error
)
{
assertJump
(
error
)
}
try
{
await
savingsWallet
.
sendTo
(
accounts
[
1
],
0
,
{
from
:
owner
})
assert
.
fail
(
'should have thrown before'
)
}
catch
(
error
)
{
assertJump
(
error
)
}
const
balance
=
web3
.
eth
.
getBalance
(
accounts
[
1
])
const
balance
=
web3
.
eth
.
getBalance
(
accounts
[
1
])
await
savingsWallet
.
sendTo
(
accounts
[
1
],
paymentAmount
,
{
from
:
owner
})
await
savingsWallet
.
sendTo
(
accounts
[
1
],
paymentAmount
,
{
from
:
owner
})
assert
.
isTrue
(
assert
.
isTrue
(
balance
.
plus
(
paymentAmount
).
equals
(
web3
.
eth
.
getBalance
(
accounts
[
1
])))
balance
.
plus
(
paymentAmount
).
equals
(
web3
.
eth
.
getBalance
(
accounts
[
1
]))
)
})
})
})
})
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