Merge branch 'bootstrap' into minimetoken

This commit is contained in:
Ricardo Guilherme Schmidt 2018-05-19 22:38:45 -03:00
commit 6c5e6ce311
2 changed files with 9 additions and 13 deletions

View File

@ -1,18 +1,15 @@
exports.Test = (tokenContract, afterDeploy) => {
exports.Test = (contractsConfig, afterDeploy) => {
describe("ERC20Token", async function() {
this.timeout(0);
var ERC20Token;
var accountsArr;
before(function(done) {
var contractsConfig = {
"Token": tokenContract,
"ERC20Receiver": { }
};
contractsConfig["ERC20Receiver"] = {};
EmbarkSpec.deployAll(contractsConfig, async function(accounts) {
ERC20Token = Token;
accountsArr = accounts;
afterDeploy(accounts, Token);
await afterDeploy(accounts, Token);
done()
});
});
@ -24,8 +21,8 @@ exports.Test = (tokenContract, afterDeploy) => {
let result0 = await ERC20Token.methods.balanceOf(accountsArr[0]).call();
let result1 = await ERC20Token.methods.balanceOf(accountsArr[1]).call();
assert.equal(result0, +initialBalance0-1);
assert.equal(result1, +initialBalance1+1);
assert.equal(result0, +initialBalance0-1, "account 0 balance unexpected");
assert.equal(result1, +initialBalance1+1, "account 1 balance unexpected");
});
it("should set approved amount", async function() {

View File

@ -11,9 +11,6 @@ describe("TestToken", async function() {
};
EmbarkSpec.deployAll(contractsConfig, async function(accounts) {
accountsArr = accounts
for(i=0;i<accountsArr.length;i++) {
await TestToken.methods.mint(7 * 10 ^ 18).send({from: accountsArr[i]})
}
done()
});
});
@ -31,8 +28,10 @@ describe("TestToken", async function() {
let result = await TestToken.methods.balanceOf(accountsArr[0]).call();
assert.equal(result, +initialBalance+100);
});
ERC20Token.Test({ "instanceOf" : "TestToken" }, async function (accounts, TestToken) {
var erc20tokenConfig = {
"Token": { "instanceOf" : "TestToken" }
}
ERC20Token.Test(erc20tokenConfig, async function (accounts, TestToken) {
for(i=0;i<accounts.length;i++){
await TestToken.methods.mint(7 * 10 ^ 18).send({from: accounts[i]})
}