visual-identity/test/testtoken.js

41 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-05-19 20:00:16 +00:00
const ERC20Token = require('./erc20token');
2018-05-13 20:54:05 +00:00
describe("TestToken", async function() {
this.timeout(0);
var accountsArr;
2018-05-13 20:54:05 +00:00
before(function(done) {
var contractsConfig = {
"TestToken": {
}
};
2018-05-13 20:54:05 +00:00
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()
});
});
it("should increase totalSupply in mint", async function() {
2018-05-13 20:54:05 +00:00
let initialSupply = await TestToken.methods.totalSupply().call();
await TestToken.methods.mint(100).send({from: accountsArr[0]});
let result = await TestToken.methods.totalSupply().call();
2018-05-13 20:54:05 +00:00
assert.equal(result, +initialSupply+100);
});
it("should increase accountBalance in mint", async function() {
let initialBalance = await TestToken.methods.balanceOf(accountsArr[0]).call();
await TestToken.methods.mint(100).send({from: accountsArr[0]});
2018-05-13 20:54:05 +00:00
let result = await TestToken.methods.balanceOf(accountsArr[0]).call();
assert.equal(result, +initialBalance+100);
});
2018-05-19 20:00:16 +00:00
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]})
}
});
});