make erc20token test abstract

This commit is contained in:
Ricardo Guilherme Schmidt 2018-05-19 17:00:16 -03:00
parent 204892e3ce
commit e63ae2af6e
2 changed files with 85 additions and 77 deletions

View File

@ -1,18 +1,18 @@
describe("ERC20Token", async function() {
exports.Test = (tokenContract, afterDeploy) => {
describe("ERC20Token", async function() {
this.timeout(0);
var ERC20Token;
var accountsArr;
before(function(done) {
var contractsConfig = {
"TestToken": { },
"Token": tokenContract,
"ERC20Receiver": { }
};
EmbarkSpec.deployAll(contractsConfig, async function(accounts) {
ERC20Token = TestToken;
ERC20Token = Token;
accountsArr = accounts;
for(i=0;i<accountsArr.length;i++){
await ERC20Token.methods.mint(7 * 10 ^ 18).send({from: accountsArr[i]})
}
afterDeploy(accounts, Token);
done()
});
});
@ -77,4 +77,5 @@ describe("ERC20Token", async function() {
//TODO: include checks for expected events fired
});
});
}

View File

@ -1,3 +1,5 @@
const ERC20Token = require('./erc20token');
describe("TestToken", async function() {
this.timeout(0);
var accountsArr;
@ -30,4 +32,9 @@ describe("TestToken", async function() {
assert.equal(result, +initialBalance+100);
});
ERC20Token.Test({ "instanceOf" : "TestToken" }, async function (accounts, TestToken) {
for(i=0;i<accounts.length;i++){
await TestToken.methods.mint(7 * 10 ^ 18).send({from: accounts[i]})
}
});
});