This commit is contained in:
Aniket-Engg
2018-10-11 14:18:33 +05:30
parent 10abc85ac1
commit 9bb567055f
13 changed files with 144 additions and 71 deletions

View File

@ -42,7 +42,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
purchaser: investor,
beneficiary: investor,
value: value,
amount: expectedTokenAmount
amount: expectedTokenAmount,
});
});

View File

@ -83,7 +83,7 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) {
purchaser: investor,
beneficiary: investor,
value: value,
amount: expectedTokenAmount
amount: expectedTokenAmount,
});
});
@ -106,7 +106,7 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) {
purchaser: purchaser,
beneficiary: investor,
value: value,
amount: expectedTokenAmount
amount: expectedTokenAmount,
});
});

View File

@ -21,7 +21,7 @@ function shouldBehaveLikeMintedCrowdsale ([_, investor, wallet, purchaser], rate
purchaser: investor,
beneficiary: investor,
value: value,
amount: expectedTokenAmount
amount: expectedTokenAmount,
});
});

View File

@ -31,7 +31,7 @@ function shouldBehaveLikeEscrow (primary, [payee1, payee2]) {
const { logs } = await this.escrow.deposit(payee1, { from: primary, value: amount });
expectEvent.inLogs(logs, 'Deposited', {
payee: payee1,
weiAmount: amount
weiAmount: amount,
});
});
@ -80,7 +80,7 @@ function shouldBehaveLikeEscrow (primary, [payee1, payee2]) {
const { logs } = await this.escrow.withdraw(payee1, { from: primary });
expectEvent.inLogs(logs, 'Withdrawn', {
payee: payee1,
weiAmount: amount
weiAmount: amount,
});
});
});

View File

@ -60,7 +60,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
expectEvent.inLogs(logs, 'Transfer', {
from: owner,
to: to,
value: amount
value: amount,
});
});
});
@ -88,7 +88,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
expectEvent.inLogs(logs, 'Approval', {
owner: owner,
spender: spender,
value: amount
value: amount,
});
});
@ -122,7 +122,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
expectEvent.inLogs(logs, 'Approval', {
owner: owner,
spender: spender,
value: amount
value: amount,
});
});
@ -192,7 +192,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
expectEvent.inLogs(logs, 'Transfer', {
from: owner,
to: to,
value: amount
value: amount,
});
});
@ -277,7 +277,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
expectEvent.inLogs(logs, 'Approval', {
owner: owner,
spender: spender,
value: 0
value: 0,
});
});
@ -334,7 +334,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
expectEvent.inLogs(logs, 'Approval', {
owner: owner,
spender: spender,
value: amount
value: amount,
});
});
@ -368,7 +368,7 @@ contract('ERC20', function ([_, owner, recipient, anotherAccount]) {
expectEvent.inLogs(logs, 'Approval', {
owner: owner,
spender: spender,
value: amount
value: amount,
});
});

View File

@ -22,9 +22,17 @@ contract('SafeERC20', function () {
await shouldFail.reverting(this.helper.doFailingApprove());
});
it('reverts on increaseAllowance', async function () {
await shouldFail.reverting(this.helper.doFailingIncreaseAllowance());
});
it('should throw on failed increaseAllowance', async function () {
await shouldFail.reverting(this.helper.doFailingIncreaseAllowance());
});
it('should throw on failed decreaseAllowance', async function () {
await shouldFail.reverting(this.helper.doFailingDecreaseAllowance());
});
it('should not throw on succeeding transfer', async function () {
await this.helper.doSucceedingTransfer();
});
it('reverts on decreaseAllowance', async function () {
await shouldFail.reverting(this.helper.doFailingDecreaseAllowance());
@ -90,4 +98,12 @@ contract('SafeERC20', function () {
});
});
});
it('should not throw on succeeding increaseAllowance', async function () {
await this.helper.doSucceedingIncreaseAllowance();
});
it('should not throw on succeeding decreaseAllowance', async function () {
await this.helper.doSucceedingDecreaseAllowance();
});
});

View File

@ -28,7 +28,7 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
expectEvent.inLogs(this.logs, 'Transfer', {
from: owner,
to: ZERO_ADDRESS,
value: amount
value: amount,
});
});
}
@ -74,7 +74,7 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
expectEvent.inLogs(this.logs, 'Transfer', {
from: owner,
to: ZERO_ADDRESS,
value: amount
value: amount,
});
});
}

View File

@ -33,7 +33,7 @@ function shouldBehaveLikeERC20Mintable (minter, [anyone]) {
expectEvent.inLogs(this.logs, 'Transfer', {
from: ZERO_ADDRESS,
to: anyone,
value: amount
value: amount,
});
});
}

View File

@ -87,7 +87,7 @@ function shouldBehaveLikeERC721 (
expectEvent.inLogs(logs, 'Transfer', {
from: owner,
to: this.toWhom,
tokenId: tokenId
tokenId: tokenId,
});
});
} else {
@ -95,7 +95,7 @@ function shouldBehaveLikeERC721 (
expectEvent.inLogs(logs, 'Transfer', {
from: owner,
to: this.toWhom,
tokenId: tokenId
tokenId: tokenId,
});
});
}
@ -160,7 +160,7 @@ function shouldBehaveLikeERC721 (
expectEvent.inLogs(logs, 'Transfer', {
from: owner,
to: owner,
tokenId: tokenId
tokenId: tokenId,
});
});
@ -336,7 +336,7 @@ function shouldBehaveLikeERC721 (
expectEvent.inLogs(logs, 'Approval', {
owner: owner,
approved: address,
tokenId: tokenId
tokenId: tokenId,
});
});
};
@ -446,7 +446,7 @@ function shouldBehaveLikeERC721 (
expectEvent.inLogs(logs, 'ApprovalForAll', {
owner: owner,
operator: operator,
approved: true
approved: true,
});
});
});
@ -468,7 +468,7 @@ function shouldBehaveLikeERC721 (
expectEvent.inLogs(logs, 'ApprovalForAll', {
owner: owner,
operator: operator,
approved: true
approved: true,
});
});
@ -496,7 +496,7 @@ function shouldBehaveLikeERC721 (
expectEvent.inLogs(logs, 'ApprovalForAll', {
owner: owner,
operator: operator,
approved: true
approved: true,
});
});
});

View File

@ -41,7 +41,7 @@ function shouldBehaveLikeMintAndBurnERC721 (
expectEvent.inLogs(logs, 'Transfer', {
from: ZERO_ADDRESS,
to: newOwner,
tokenId: thirdTokenId
tokenId: thirdTokenId,
});
});
});
@ -86,7 +86,7 @@ function shouldBehaveLikeMintAndBurnERC721 (
expectEvent.inLogs(logs, 'Transfer', {
from: owner,
to: ZERO_ADDRESS,
tokenId: tokenId
tokenId: tokenId,
});
});
});