Skip to content

Commit

Permalink
StdDaoToken: test mintFor() and burnFor() while voting is started #178
Browse files Browse the repository at this point in the history
  • Loading branch information
RostyslavBortman committed Jul 11, 2018
1 parent 709d495 commit 19c81ec
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/tokens/StdDaoTokenTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,43 @@ require('chai')
assert.equal(employee5VotingBalance.toNumber(), 0);
});

it('should preserve balances after voting is started and burnFor called',async() => {
this.token = await StdDaoToken.new("StdToken","STDT",18, true, true, ETH);
await this.token.mintFor(employee4, 1);

const tx = await this.token.startNewVoting();
const events = tx.logs.filter(l => l.event == 'VotingCreated');
const votingID = events.filter(e => e.args._address == creator)[0].args._votingID;

await this.token.burnFor(employee4, 1);

employee4Balance = await this.token.balanceOf(employee4);

employee4VotingBalance = await this.token.getBalanceAtVoting(votingID, employee4);

assert.equal(employee4Balance.toNumber(), 0);

assert.equal(employee4VotingBalance.toNumber(), 1);
});

it('should preserve balances after voting is started and mintFor called',async() => {
this.token = await StdDaoToken.new("StdToken","STDT",18, false, true, ETH);

const tx = await this.token.startNewVoting();
const events = tx.logs.filter(l => l.event == 'VotingCreated');
const votingID = events.filter(e => e.args._address == creator)[0].args._votingID;

await this.token.mintFor(employee4, 1);

employee4Balance = await this.token.balanceOf(employee4);

employee4VotingBalance = await this.token.getBalanceAtVoting(votingID, employee4);

assert.equal(employee4Balance.toNumber(), 1);

assert.equal(employee4VotingBalance.toNumber(), 0);
});

it('should throw exception when trying to check balancesAtVoting after voting is ended',async() => {
this.token = await StdDaoToken.new("StdToken","STDT",18, false, true, ETH);
await this.token.mintFor(employee4, 1);
Expand Down

0 comments on commit 19c81ec

Please sign in to comment.