2018-05-13 20:54:05 +00:00
|
|
|
describe("TestToken", async function() {
|
2018-05-13 00:16:18 +00:00
|
|
|
this.timeout(0);
|
|
|
|
var accountsArr;
|
2018-05-13 20:54:05 +00:00
|
|
|
|
2018-05-13 00:16:18 +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()
|
|
|
|
});
|
2018-05-13 00:16:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should increase totalSupply in mint", async function() {
|
2018-05-13 20:54:05 +00:00
|
|
|
let initialSupply = await TestToken.methods.totalSupply().call();
|
2018-05-13 00:16:18 +00:00
|
|
|
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);
|
2018-05-13 00:16:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
2018-05-13 00:16:18 +00:00
|
|
|
assert.equal(result, +initialBalance+100);
|
|
|
|
});
|
2018-05-13 20:54:05 +00:00
|
|
|
|
2018-05-13 00:16:18 +00:00
|
|
|
});
|