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
5e784753
Commit
5e784753
authored
Jul 22, 2017
by
Jakub Wojciechowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix testing error throwing
parent
4d91118d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
15 deletions
+23
-15
Claimable.js
test/Claimable.js
+4
-2
DayLimit.js
test/DayLimit.js
+11
-7
Ownable.js
test/Ownable.js
+2
-1
Pausable.js
test/Pausable.js
+6
-5
No files found.
test/Claimable.js
View file @
5e784753
...
...
@@ -27,8 +27,9 @@ contract('Claimable', function(accounts) {
try
{
await
claimable
.
claimOwnership
({
from
:
accounts
[
2
]});
}
catch
(
error
)
{
assertJump
(
error
);
return
assertJump
(
error
);
}
assert
.
fail
(
'should have thrown before'
);
});
it
(
'should prevent non-owners from transfering'
,
async
function
()
{
...
...
@@ -38,8 +39,9 @@ contract('Claimable', function(accounts) {
try
{
await
claimable
.
transferOwnership
(
other
,
{
from
:
other
});
}
catch
(
error
)
{
assertJump
(
error
);
return
assertJump
(
error
);
}
assert
.
fail
(
'should have thrown before'
);
});
describe
(
'after initiating a transfer'
,
function
()
{
...
...
test/DayLimit.js
View file @
5e784753
...
...
@@ -37,8 +37,9 @@ contract('DayLimit', function(accounts) {
try
{
await
dayLimit
.
attemptSpend
(
3
);
}
catch
(
error
)
{
assertJump
(
error
);
return
assertJump
(
error
);
}
assert
.
fail
(
'should have thrown before'
);
});
it
(
'should allow spending if daily limit is reached and then set higher'
,
async
function
()
{
...
...
@@ -50,14 +51,15 @@ contract('DayLimit', function(accounts) {
await
dayLimit
.
attemptSpend
(
3
);
}
catch
(
error
)
{
assertJump
(
error
);
}
spentToday
=
await
dayLimit
.
spentToday
();
assert
.
equal
(
spentToday
,
8
);
await
dayLimit
.
setDailyLimit
(
15
);
await
dayLimit
.
attemptSpend
(
3
);
spentToday
=
await
dayLimit
.
spentToday
();
assert
.
equal
(
spentToday
,
11
);
return
assert
.
equal
(
spentToday
,
11
);
}
assert
.
fail
(
'should have thrown before'
);
});
it
(
'should allow spending if daily limit is reached and then amount spent is reset'
,
async
function
()
{
...
...
@@ -69,14 +71,15 @@ contract('DayLimit', function(accounts) {
await
dayLimit
.
attemptSpend
(
3
);
}
catch
(
error
)
{
assertJump
(
error
);
}
spentToday
=
await
dayLimit
.
spentToday
();
assert
.
equal
(
spentToday
,
8
);
await
dayLimit
.
resetSpentToday
(
15
);
await
dayLimit
.
attemptSpend
(
3
);
spentToday
=
await
dayLimit
.
spentToday
();
assert
.
equal
(
spentToday
,
3
);
return
assert
.
equal
(
spentToday
,
3
);
}
assert
.
fail
(
'should have thrown before'
);
});
it
(
'should allow spending if daily limit is reached and then the next has come'
,
async
function
()
{
...
...
@@ -91,7 +94,6 @@ contract('DayLimit', function(accounts) {
await
dayLimit
.
attemptSpend
(
3
);
}
catch
(
error
)
{
assertJump
(
error
);
}
spentToday
=
await
dayLimit
.
spentToday
();
assert
.
equal
(
spentToday
,
8
);
...
...
@@ -99,7 +101,9 @@ contract('DayLimit', function(accounts) {
await
dayLimit
.
attemptSpend
(
3
);
spentToday
=
await
dayLimit
.
spentToday
();
assert
.
equal
(
spentToday
,
3
);
return
assert
.
equal
(
spentToday
,
3
);
}
assert
.
fail
(
'should have thrown before'
);
});
});
test/Ownable.js
View file @
5e784753
...
...
@@ -30,8 +30,9 @@ contract('Ownable', function(accounts) {
try
{
await
ownable
.
transferOwnership
(
other
,
{
from
:
other
});
}
catch
(
error
)
{
assertJump
(
error
);
return
assertJump
(
error
);
}
assert
.
fail
(
'should have thrown before'
);
});
it
(
'should guard ownership against stuck state'
,
async
function
()
{
...
...
test/Pausable.js
View file @
5e784753
...
...
@@ -24,10 +24,11 @@ contract('Pausable', function(accounts) {
try
{
await
Pausable
.
normalProcess
();
}
catch
(
error
)
{
assertJump
(
error
);
}
let
count1
=
await
Pausable
.
count
();
assert
.
equal
(
count1
,
0
);
return
assertJump
(
error
);
}
assert
.
fail
(
'should have thrown before'
);
});
...
...
@@ -36,11 +37,11 @@ contract('Pausable', function(accounts) {
try
{
await
Pausable
.
drasticMeasure
();
}
catch
(
error
)
{
assertJump
(
error
);
}
const
drasticMeasureTaken
=
await
Pausable
.
drasticMeasureTaken
();
assert
.
isFalse
(
drasticMeasureTaken
);
return
assertJump
(
error
);
}
assert
.
fail
(
'should have thrown before'
);
});
it
(
'can take a drastic measure in a pause'
,
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