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
c70ee937
Commit
c70ee937
authored
Nov 30, 2017
by
zava
Committed by
Alejandro Santander
Jan 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Inheritable.js] replace assertJump for expectThrow
parent
46736da4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
35 deletions
+7
-35
Inheritable.js
test/Inheritable.js
+7
-35
No files found.
test/Inheritable.js
View file @
c70ee937
'use strict'
'use strict'
import
{
advanceBlock
}
from
'./helpers/advanceToBlock'
import
increaseTime
from
'./helpers/increaseTime'
import
increaseTime
from
'./helpers/increaseTime'
import
{
increaseTimeTo
,
duration
}
from
'./helpers/increaseTime'
import
expectThrow
from
'./helpers/expectThrow'
;
import
assertJump
from
'./helpers/assertJump'
const
NULL_ADDRESS
=
'0x0000000000000000000000000000000000000000'
const
NULL_ADDRESS
=
'0x0000000000000000000000000000000000000000'
...
@@ -39,12 +36,7 @@ contract('Inheritable', function(accounts) {
...
@@ -39,12 +36,7 @@ contract('Inheritable', function(accounts) {
assert
.
isTrue
(
owner
!==
someRandomAddress
)
assert
.
isTrue
(
owner
!==
someRandomAddress
)
await
inheritable
.
setHeir
(
newHeir
,
{
from
:
owner
})
await
inheritable
.
setHeir
(
newHeir
,
{
from
:
owner
})
try
{
await
expectThrow
(
inheritable
.
setHeir
(
newHeir
,
{
from
:
someRandomAddress
}))
await
inheritable
.
setHeir
(
newHeir
,
{
from
:
someRandomAddress
})
assert
.
fail
(
'should have thrown before'
)
}
catch
(
error
)
{
assertJump
(
error
)
}
})
})
it
(
'owner can remove heir'
,
async
function
()
{
it
(
'owner can remove heir'
,
async
function
()
{
...
@@ -61,25 +53,15 @@ contract('Inheritable', function(accounts) {
...
@@ -61,25 +53,15 @@ contract('Inheritable', function(accounts) {
it
(
'heir can inherit only if owner is dead and timeout was reached'
,
async
function
()
{
it
(
'heir can inherit only if owner is dead and timeout was reached'
,
async
function
()
{
const
heir
=
accounts
[
1
]
const
heir
=
accounts
[
1
]
await
inheritable
.
setHeir
(
heir
,
{
from
:
owner
})
await
inheritable
.
setHeir
(
heir
,
{
from
:
owner
})
await
expectThrow
(
inheritable
.
inherit
({
from
:
heir
}))
try
{
await
inheritable
.
inherit
({
from
:
heir
})
assert
.
fail
(
'should have thrown before'
)
}
catch
(
error
)
{
assertJump
(
error
)
}
await
inheritable
.
proclaimDeath
({
from
:
heir
})
await
inheritable
.
proclaimDeath
({
from
:
heir
})
await
increaseTime
(
1
)
await
increaseTime
(
1
)
try
{
await
expectThrow
(
inheritable
.
inherit
({
from
:
heir
}))
await
inheritable
.
inherit
({
from
:
heir
})
assert
.
fail
(
'should have thrown before'
)
}
catch
(
error
)
{
assertJump
(
error
)
}
await
increaseTime
(
4141
)
await
increaseTime
(
4141
)
await
inheritable
.
inherit
({
from
:
heir
})
await
inheritable
.
inherit
({
from
:
heir
})
assert
.
isTrue
(
await
inheritable
.
heir
()
===
heir
)
})
})
it
(
'heir can
\'
t inherit if owner heartbeats'
,
async
function
()
{
it
(
'heir can
\'
t inherit if owner heartbeats'
,
async
function
()
{
...
@@ -88,22 +70,12 @@ contract('Inheritable', function(accounts) {
...
@@ -88,22 +70,12 @@ contract('Inheritable', function(accounts) {
await
inheritable
.
proclaimDeath
({
from
:
heir
})
await
inheritable
.
proclaimDeath
({
from
:
heir
})
await
inheritable
.
heartbeat
({
from
:
owner
})
await
inheritable
.
heartbeat
({
from
:
owner
})
try
{
await
expectThrow
(
inheritable
.
inherit
({
from
:
heir
}))
await
inheritable
.
inherit
({
from
:
heir
})
assert
.
fail
(
'should have thrown before'
)
}
catch
(
error
)
{
assertJump
(
error
)
}
await
inheritable
.
proclaimDeath
({
from
:
heir
})
await
inheritable
.
proclaimDeath
({
from
:
heir
})
await
increaseTime
(
4141
)
await
increaseTime
(
4141
)
await
inheritable
.
heartbeat
({
from
:
owner
})
await
inheritable
.
heartbeat
({
from
:
owner
})
try
{
await
expectThrow
(
inheritable
.
inherit
({
from
:
heir
}))
await
inheritable
.
inherit
({
from
:
heir
})
assert
.
fail
(
'should have thrown before'
)
}
catch
(
error
)
{
assertJump
(
error
)
}
})
})
it
(
'should log events appropriately'
,
async
function
()
{
it
(
'should log events appropriately'
,
async
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