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
7dd0ee62
Commit
7dd0ee62
authored
Nov 12, 2017
by
Manuel Araoz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove timer
parent
c4ca7f03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
31 deletions
+4
-31
DayLimit.js
test/DayLimit.js
+4
-2
timer.js
test/helpers/timer.js
+0
-29
No files found.
test/DayLimit.js
View file @
7dd0ee62
'use strict'
;
'use strict'
;
const
assertJump
=
require
(
'./helpers/assertJump'
);
const
assertJump
=
require
(
'./helpers/assertJump'
);
const
timer
=
require
(
'./helpers/timer'
);
import
latestTime
from
'./helpers/latestTime'
import
{
increaseTimeTo
,
duration
}
from
'./helpers/increaseTime'
var
DayLimitMock
=
artifacts
.
require
(
'./helpers/DayLimitMock.sol'
);
var
DayLimitMock
=
artifacts
.
require
(
'./helpers/DayLimitMock.sol'
);
...
@@ -11,6 +12,7 @@ contract('DayLimit', function(accounts) {
...
@@ -11,6 +12,7 @@ contract('DayLimit', function(accounts) {
let
initLimit
=
10
;
let
initLimit
=
10
;
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
startTime
=
latestTime
();
dayLimit
=
await
DayLimitMock
.
new
(
initLimit
);
dayLimit
=
await
DayLimitMock
.
new
(
initLimit
);
});
});
...
@@ -99,7 +101,7 @@ contract('DayLimit', function(accounts) {
...
@@ -99,7 +101,7 @@ contract('DayLimit', function(accounts) {
spentToday
=
await
dayLimit
.
spentToday
();
spentToday
=
await
dayLimit
.
spentToday
();
assert
.
equal
(
spentToday
,
8
);
assert
.
equal
(
spentToday
,
8
);
await
timer
(
day
);
await
increaseTimeTo
(
this
.
startTime
+
duration
.
days
(
1
)
);
await
dayLimit
.
attemptSpend
(
3
);
await
dayLimit
.
attemptSpend
(
3
);
spentToday
=
await
dayLimit
.
spentToday
();
spentToday
=
await
dayLimit
.
spentToday
();
...
...
test/helpers/timer.js
deleted
100644 → 0
View file @
c4ca7f03
'use strict'
;
// timer for tests specific to testrpc
// s is the amount of seconds to advance
// if account is provided, will send a transaction from that account to force testrpc to mine the block
module
.
exports
=
(
s
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
web3
.
currentProvider
.
sendAsync
({
jsonrpc
:
'2.0'
,
method
:
'evm_increaseTime'
,
params
:
[
s
],
id
:
new
Date
().
getTime
()
},
function
(
err
)
{
if
(
err
)
{
return
reject
(
err
);
}
web3
.
currentProvider
.
sendAsync
({
jsonrpc
:
'2.0'
,
method
:
'evm_mine'
,
id
:
new
Date
().
getTime
()
},
(
err
,
result
)
=>
{
if
(
err
)
{
return
reject
(
err
);
}
resolve
(
result
);
});
});
});
};
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