|
@@ -18,26 +18,20 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
|
|
|
describe('total supply', function () {
|
|
|
it('returns the total amount of tokens', async function () {
|
|
|
- const totalSupply = await this.token.totalSupply();
|
|
|
-
|
|
|
- totalSupply.should.be.bignumber.equal(100);
|
|
|
+ (await this.token.totalSupply()).should.be.bignumber.equal(100);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('balanceOf', function () {
|
|
|
describe('when the requested account has no tokens', function () {
|
|
|
it('returns zero', async function () {
|
|
|
- const balance = await this.token.balanceOf(anotherAccount);
|
|
|
-
|
|
|
- balance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.balanceOf(anotherAccount)).should.be.bignumber.equal(0);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('when the requested account has some tokens', function () {
|
|
|
it('returns the total amount of tokens', async function () {
|
|
|
- const balance = await this.token.balanceOf(owner);
|
|
|
-
|
|
|
- balance.should.be.bignumber.equal(100);
|
|
|
+ (await this.token.balanceOf(owner)).should.be.bignumber.equal(100);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -60,11 +54,9 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('transfers the requested amount', async function () {
|
|
|
await this.token.transfer(to, amount, { from: owner });
|
|
|
|
|
|
- const senderBalance = await this.token.balanceOf(owner);
|
|
|
- senderBalance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.balanceOf(owner)).should.be.bignumber.equal(0);
|
|
|
|
|
|
- const recipientBalance = await this.token.balanceOf(to);
|
|
|
- recipientBalance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.balanceOf(to)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
|
|
|
it('emits a transfer event', async function () {
|
|
@@ -110,8 +102,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('approves the requested amount', async function () {
|
|
|
await this.token.approve(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -123,8 +114,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('approves the requested amount and replaces the previous one', async function () {
|
|
|
await this.token.approve(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -146,8 +136,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('approves the requested amount', async function () {
|
|
|
await this.token.approve(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -159,8 +148,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('approves the requested amount and replaces the previous one', async function () {
|
|
|
await this.token.approve(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -173,8 +161,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('approves the requested amount', async function () {
|
|
|
await this.token.approve(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
|
|
|
it('emits an approval event', async function () {
|
|
@@ -206,18 +193,15 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('transfers the requested amount', async function () {
|
|
|
await this.token.transferFrom(owner, to, amount, { from: spender });
|
|
|
|
|
|
- const senderBalance = await this.token.balanceOf(owner);
|
|
|
- senderBalance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.balanceOf(owner)).should.be.bignumber.equal(0);
|
|
|
|
|
|
- const recipientBalance = await this.token.balanceOf(to);
|
|
|
- recipientBalance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.balanceOf(to)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
|
|
|
it('decreases the spender allowance', async function () {
|
|
|
await this.token.transferFrom(owner, to, amount, { from: spender });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
|
|
|
});
|
|
|
|
|
|
it('emits a transfer event', async function () {
|
|
@@ -298,8 +282,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('keeps the allowance to zero', async function () {
|
|
|
await this.token.decreaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -313,20 +296,17 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('decreases the spender allowance subtracting the requested amount', async function () {
|
|
|
await this.token.decreaseApproval(spender, approvedAmount - 5, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(5);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(5);
|
|
|
});
|
|
|
|
|
|
it('sets the allowance to zero when all allowance is removed', async function () {
|
|
|
await this.token.decreaseApproval(spender, approvedAmount, { from: owner });
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
|
|
|
});
|
|
|
|
|
|
it('sets the allowance to zero when more than the full allowance is removed', async function () {
|
|
|
await this.token.decreaseApproval(spender, approvedAmount + 5, { from: owner });
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -348,8 +328,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('keeps the allowance to zero', async function () {
|
|
|
await this.token.decreaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -361,8 +340,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('decreases the spender allowance subtracting the requested amount', async function () {
|
|
|
await this.token.decreaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(1);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(1);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -375,8 +353,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('decreases the requested amount', async function () {
|
|
|
await this.token.decreaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(0);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
|
|
|
});
|
|
|
|
|
|
it('emits an approval event', async function () {
|
|
@@ -412,8 +389,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('approves the requested amount', async function () {
|
|
|
await this.token.increaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -425,8 +401,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('increases the spender allowance adding the requested amount', async function () {
|
|
|
await this.token.increaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount + 1);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount + 1);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -448,8 +423,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('approves the requested amount', async function () {
|
|
|
await this.token.increaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -461,8 +435,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('increases the spender allowance adding the requested amount', async function () {
|
|
|
await this.token.increaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount + 1);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount + 1);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -474,8 +447,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
|
|
|
it('approves the requested amount', async function () {
|
|
|
await this.token.increaseApproval(spender, amount, { from: owner });
|
|
|
|
|
|
- const allowance = await this.token.allowance(owner, spender);
|
|
|
- allowance.should.be.bignumber.equal(amount);
|
|
|
+ (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
|
|
|
});
|
|
|
|
|
|
it('emits an approval event', async function () {
|