aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-12-17 14:40:19 +0800
committerFabio Berger <me@fabioberger.com>2017-12-17 14:40:19 +0800
commitac78c64f9ec0c1894dce051154a675428c5540e0 (patch)
tree8dc867210e51c63a17b2754b5e3e71946b871691 /packages/contracts
parent1f748afed96ed40d1ee61b970e8c6fe2a75fa382 (diff)
downloaddexon-sol-tools-ac78c64f9ec0c1894dce051154a675428c5540e0.tar
dexon-sol-tools-ac78c64f9ec0c1894dce051154a675428c5540e0.tar.gz
dexon-sol-tools-ac78c64f9ec0c1894dce051154a675428c5540e0.tar.bz2
dexon-sol-tools-ac78c64f9ec0c1894dce051154a675428c5540e0.tar.lz
dexon-sol-tools-ac78c64f9ec0c1894dce051154a675428c5540e0.tar.xz
dexon-sol-tools-ac78c64f9ec0c1894dce051154a675428c5540e0.tar.zst
dexon-sol-tools-ac78c64f9ec0c1894dce051154a675428c5540e0.zip
Fix tests in contracts
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/test/ts/ether_token.ts9
-rw-r--r--packages/contracts/test/ts/ether_token_v2.ts15
2 files changed, 11 insertions, 13 deletions
diff --git a/packages/contracts/test/ts/ether_token.ts b/packages/contracts/test/ts/ether_token.ts
index 2f9df59a4..99630583f 100644
--- a/packages/contracts/test/ts/ether_token.ts
+++ b/packages/contracts/test/ts/ether_token.ts
@@ -28,7 +28,6 @@ contract('EtherToken', (accounts: string[]) => {
etherTokenAddress = EtherToken.address;
zeroEx = new ZeroEx(web3.currentProvider, {
gasPrice,
- etherTokenContractAddress: etherTokenAddress,
networkId: constants.TESTRPC_NETWORK_ID,
});
});
@@ -45,7 +44,7 @@ contract('EtherToken', (accounts: string[]) => {
const initEthBalance = await getEthBalanceAsync(account);
const ethToDeposit = initEthBalance.plus(1);
- return expect(zeroEx.etherToken.depositAsync(ethToDeposit, account))
+ return expect(zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account))
.to.be.rejectedWith(ZeroExError.InsufficientEthBalanceForDeposit);
});
@@ -55,7 +54,7 @@ contract('EtherToken', (accounts: string[]) => {
const ethToDeposit = new BigNumber(web3.toWei(1, 'ether'));
- const txHash = await zeroEx.etherToken.depositAsync(ethToDeposit, account);
+ const txHash = await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
@@ -72,7 +71,7 @@ contract('EtherToken', (accounts: string[]) => {
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
const ethTokensToWithdraw = initEthTokenBalance.plus(1);
- return expect(zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account))
+ return expect(zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account))
.to.be.rejectedWith(ZeroExError.InsufficientWEthBalanceForWithdrawal);
});
@@ -81,7 +80,7 @@ contract('EtherToken', (accounts: string[]) => {
const initEthBalance = await getEthBalanceAsync(account);
const ethTokensToWithdraw = initEthTokenBalance;
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
- const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account, {
+ const txHash = await zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account, {
gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS,
});
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
diff --git a/packages/contracts/test/ts/ether_token_v2.ts b/packages/contracts/test/ts/ether_token_v2.ts
index 61ac4cb57..480c4035b 100644
--- a/packages/contracts/test/ts/ether_token_v2.ts
+++ b/packages/contracts/test/ts/ether_token_v2.ts
@@ -28,7 +28,6 @@ contract('EtherTokenV2', (accounts: string[]) => {
etherTokenAddress = etherToken.address;
zeroEx = new ZeroEx(web3.currentProvider, {
gasPrice,
- etherTokenContractAddress: etherTokenAddress,
networkId: constants.TESTRPC_NETWORK_ID,
});
});
@@ -45,7 +44,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
const initEthBalance = await getEthBalanceAsync(account);
const ethToDeposit = initEthBalance.plus(1);
- return expect(zeroEx.etherToken.depositAsync(ethToDeposit, account))
+ return expect(zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account))
.to.be.rejectedWith(ZeroExError.InsufficientEthBalanceForDeposit);
});
@@ -55,7 +54,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
const ethToDeposit = new BigNumber(web3.toWei(1, 'ether'));
- const txHash = await zeroEx.etherToken.depositAsync(ethToDeposit, account);
+ const txHash = await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
@@ -69,7 +68,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
it('should log 1 event with correct arguments', async () => {
const ethToDeposit = new BigNumber(web3.toWei(1, 'ether'));
- const txHash = await zeroEx.etherToken.depositAsync(ethToDeposit, account);
+ const txHash = await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
const logs = receipt.logs;
@@ -88,14 +87,14 @@ contract('EtherTokenV2', (accounts: string[]) => {
describe('withdraw', () => {
beforeEach(async () => {
const ethToDeposit = new BigNumber(web3.toWei(1, 'ether'));
- await zeroEx.etherToken.depositAsync(ethToDeposit, account);
+ await zeroEx.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account);
});
it('should throw if caller attempts to withdraw greater than caller balance', async () => {
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
const ethTokensToWithdraw = initEthTokenBalance.plus(1);
- return expect(zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account))
+ return expect(zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account))
.to.be.rejectedWith(ZeroExError.InsufficientWEthBalanceForWithdrawal);
});
@@ -104,7 +103,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
const initEthBalance = await getEthBalanceAsync(account);
const ethTokensToWithdraw = initEthTokenBalance;
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
- const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account, {
+ const txHash = await zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account, {
gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS,
});
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
@@ -122,7 +121,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
const ethTokensToWithdraw = initEthTokenBalance;
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
- const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account, {
+ const txHash = await zeroEx.etherToken.withdrawAsync(etherTokenAddress, ethTokensToWithdraw, account, {
gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS,
});
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);