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
575372f6
Commit
575372f6
authored
Oct 25, 2017
by
Chris Whinfrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Capped Token tests
parent
7a26a0ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
CappedToken.js
test/CappedToken.js
+39
-0
No files found.
test/CappedToken.js
0 → 100644
View file @
575372f6
'use strict'
;
import
expectThrow
from
'./helpers/expectThrow'
;
import
ether
from
'./helpers/ether'
;
var
CappedToken
=
artifacts
.
require
(
'../contracts/Tokens/CappedToken.sol'
);
const
BigNumber
=
web3
.
BigNumber
contract
(
'Capped'
,
function
(
accounts
)
{
const
cap
=
ether
(
1000
);
let
token
;
beforeEach
(
async
function
()
{
token
=
await
CappedToken
.
new
(
cap
);
})
it
(
'should start with the correct cap'
,
async
function
()
{
let
_cap
=
await
token
.
cap
();
assert
.
equal
(
cap
.
toNumber
(),
_cap
.
toNumber
());
})
it
(
'should mint when amount does amount does not exceed the cap'
,
async
function
()
{
const
result
=
await
token
.
mint
(
accounts
[
0
],
100
);
assert
.
equal
(
result
.
logs
[
0
].
event
,
'Mint'
);
})
it
(
'should fail to mint if the ammount exceeds the cap'
,
async
function
()
{
await
token
.
mint
(
accounts
[
0
],
cap
.
sub
(
1
));
await
expectThrow
(
token
.
mint
(
accounts
[
0
],
100
));
})
it
(
'should fail to mint after cap is reached'
,
async
function
()
{
await
token
.
mint
(
accounts
[
0
],
cap
);
await
expectThrow
(
token
.
mint
(
accounts
[
0
],
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