Refactoring to not DRY.
The latest test case is not affected since the aproval is for accounts[1], which does the transaction, and it is independent of the amount of tokens that accounts[0] might have.
This commit is contained in:
@ -5,8 +5,13 @@ var StandardTokenMock = artifacts.require('./helpers/StandardTokenMock.sol');
|
|||||||
|
|
||||||
contract('StandardToken', function(accounts) {
|
contract('StandardToken', function(accounts) {
|
||||||
|
|
||||||
|
let token;
|
||||||
|
|
||||||
|
beforeEach(async function() {
|
||||||
|
token = await StandardTokenMock.new(accounts[0], 100);
|
||||||
|
});
|
||||||
|
|
||||||
it('should return the correct totalSupply after construction', async function() {
|
it('should return the correct totalSupply after construction', async function() {
|
||||||
let token = await StandardTokenMock.new(accounts[0], 100);
|
|
||||||
let totalSupply = await token.totalSupply();
|
let totalSupply = await token.totalSupply();
|
||||||
|
|
||||||
assert.equal(totalSupply, 100);
|
assert.equal(totalSupply, 100);
|
||||||
@ -56,7 +61,6 @@ contract('StandardToken', function(accounts) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when trying to transfer more than allowed', async function() {
|
it('should throw an error when trying to transfer more than allowed', async function() {
|
||||||
let token = await StandardTokenMock.new();
|
|
||||||
await token.approve(accounts[1], 99);
|
await token.approve(accounts[1], 99);
|
||||||
try {
|
try {
|
||||||
await token.transferFrom(accounts[0], accounts[2], 100, {from: accounts[1]});
|
await token.transferFrom(accounts[0], accounts[2], 100, {from: accounts[1]});
|
||||||
|
|||||||
Reference in New Issue
Block a user