|
|
|
@ -9,32 +9,30 @@ require('chai') |
|
|
|
|
.should(); |
|
|
|
|
|
|
|
|
|
contract('SimpleToken', function ([_, creator]) { |
|
|
|
|
let token; |
|
|
|
|
|
|
|
|
|
beforeEach(async function () { |
|
|
|
|
token = await SimpleToken.new({ from: creator }); |
|
|
|
|
this.token = await SimpleToken.new({ from: creator }); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('has a name', async function () { |
|
|
|
|
(await token.name()).should.equal('SimpleToken'); |
|
|
|
|
(await this.token.name()).should.equal('SimpleToken'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('has a symbol', async function () { |
|
|
|
|
(await token.symbol()).should.equal('SIM'); |
|
|
|
|
(await this.token.symbol()).should.equal('SIM'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('has 18 decimals', async function () { |
|
|
|
|
(await token.decimals()).should.be.bignumber.equal(18); |
|
|
|
|
(await this.token.decimals()).should.be.bignumber.equal(18); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('assigns the initial total supply to the creator', async function () { |
|
|
|
|
const totalSupply = await token.totalSupply(); |
|
|
|
|
const creatorBalance = await token.balanceOf(creator); |
|
|
|
|
const totalSupply = await this.token.totalSupply(); |
|
|
|
|
const creatorBalance = await this.token.balanceOf(creator); |
|
|
|
|
|
|
|
|
|
creatorBalance.should.be.bignumber.equal(totalSupply); |
|
|
|
|
|
|
|
|
|
const receipt = await web3.eth.getTransactionReceipt(token.transactionHash); |
|
|
|
|
const logs = decodeLogs(receipt.logs, SimpleToken, token.address); |
|
|
|
|
const receipt = await web3.eth.getTransactionReceipt(this.token.transactionHash); |
|
|
|
|
const logs = decodeLogs(receipt.logs, SimpleToken, this.token.address); |
|
|
|
|
logs.length.should.equal(1); |
|
|
|
|
logs[0].event.should.equal('Transfer'); |
|
|
|
|
logs[0].args.from.valueOf().should.equal(ZERO_ADDRESS); |
|
|
|
|