mirror of
https://github.com/status-im/ens-usernames.git
synced 2025-02-22 15:18:14 +00:00
* trim trailing spaces * update to embark 4.0.2 * bump to solc 0.5.4 * use .selector * use solidity function selector * update to embark 6.0.0 * use mocks instead of "instanceOf" tool+tests fix * update to solidity 0.5.11 * update to solidity 0.5.11 * add spdx license identifiers * update ENS contracts * natspec fix return values
58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
const Utils = require('../utils/testUtils');
|
|
const TestToken = artifacts.require('TestToken');
|
|
const ERC20TokenSpec = require('./abstract/erc20tokenspec');
|
|
|
|
config({
|
|
contracts: {
|
|
deploy: {
|
|
"TestToken": {
|
|
},
|
|
...ERC20TokenSpec.contracts
|
|
}
|
|
}
|
|
});
|
|
|
|
contract("TestToken", function() {
|
|
this.timeout(0);
|
|
var accounts;
|
|
before(function(done) {
|
|
web3.eth.getAccounts().then(function (res) {
|
|
accounts = res;
|
|
done();
|
|
});
|
|
});
|
|
|
|
it("should increase totalSupply in mint", async function() {
|
|
let initialSupply = await TestToken.methods.totalSupply().call();
|
|
await TestToken.methods.mint(100).send();
|
|
let result = await TestToken.methods.totalSupply().call();
|
|
assert.equal(+result, +initialSupply+100);
|
|
});
|
|
|
|
it("should increase accountBalance in mint", async function() {
|
|
let initialBalance = await TestToken.methods.balanceOf(accounts[0]).call();
|
|
await TestToken.methods.mint(100).send({from: accounts[0]});
|
|
let result = await TestToken.methods.balanceOf(accounts[0]).call();
|
|
assert.equal(+result, +initialBalance+100);
|
|
});
|
|
|
|
it("should burn account supply", async function() {
|
|
let initialBalance = await TestToken.methods.balanceOf(accounts[0]).call();
|
|
await TestToken.methods.transfer(Utils.zeroAddress, initialBalance).send({from: accounts[0]});
|
|
assert.equal(+await TestToken.methods.totalSupply().call(), 0);
|
|
assert.equal(+await TestToken.methods.balanceOf(accounts[0]).call(), 0);
|
|
})
|
|
|
|
it("should mint balances for ERC20TokenSpec", async function() {
|
|
let initialBalance = 7 * 10 ^ 18;
|
|
for(i=0;i<accounts.length;i++){
|
|
await TestToken.methods.mint(initialBalance).send({from: accounts[i]})
|
|
assert.equal(+await TestToken.methods.balanceOf(accounts[i]).call(), initialBalance);
|
|
}
|
|
})
|
|
|
|
ERC20TokenSpec.Test(TestToken);
|
|
|
|
|
|
});
|