aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-07-12 05:16:09 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-07-12 08:54:57 +0800
commit6033c1a5d5f494d1ed27b00488ca458952341ae6 (patch)
tree17b53c7971047ca57b235c5351e972da721c09a4 /test
parent38fbf028a6699c7d8e853db4699a37cdf60e70c2 (diff)
downloaddexon-sol-tools-6033c1a5d5f494d1ed27b00488ca458952341ae6.tar
dexon-sol-tools-6033c1a5d5f494d1ed27b00488ca458952341ae6.tar.gz
dexon-sol-tools-6033c1a5d5f494d1ed27b00488ca458952341ae6.tar.bz2
dexon-sol-tools-6033c1a5d5f494d1ed27b00488ca458952341ae6.tar.lz
dexon-sol-tools-6033c1a5d5f494d1ed27b00488ca458952341ae6.tar.xz
dexon-sol-tools-6033c1a5d5f494d1ed27b00488ca458952341ae6.tar.zst
dexon-sol-tools-6033c1a5d5f494d1ed27b00488ca458952341ae6.zip
Use PascalCase names as string enum keys
Diffstat (limited to 'test')
-rw-r--r--test/ether_token_wrapper_test.ts4
-rw-r--r--test/exchange_wrapper_test.ts34
-rw-r--r--test/token_wrapper_test.ts20
-rw-r--r--test/utils/token_utils.ts2
4 files changed, 30 insertions, 30 deletions
diff --git a/test/ether_token_wrapper_test.ts b/test/ether_token_wrapper_test.ts
index ebce81e97..5ed800fc7 100644
--- a/test/ether_token_wrapper_test.ts
+++ b/test/ether_token_wrapper_test.ts
@@ -66,7 +66,7 @@ describe('EtherTokenWrapper', () => {
return expect(
zeroEx.etherToken.depositAsync(overETHBalanceinWei, addressWithETH),
- ).to.be.rejectedWith(ZeroExError.INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT);
+ ).to.be.rejectedWith(ZeroExError.InsufficientEthBalanceForDeposit);
});
});
describe('#withdrawAsync', () => {
@@ -100,7 +100,7 @@ describe('EtherTokenWrapper', () => {
return expect(
zeroEx.etherToken.withdrawAsync(overWETHBalance, addressWithETH),
- ).to.be.rejectedWith(ZeroExError.INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL);
+ ).to.be.rejectedWith(ZeroExError.InsufficientWEthBalanceForWithdrawal);
});
});
});
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index eb07b09ba..0dc67bb01 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -111,7 +111,7 @@ describe('ExchangeWrapper', () => {
return expect(zeroEx.exchange.fillOrKillOrderAsync(
signedOrder, tooLargeFillAmount, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_REMAINING_FILL_AMOUNT);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientRemainingFillAmount);
});
});
describe('successful fills', () => {
@@ -183,7 +183,7 @@ describe('ExchangeWrapper', () => {
const zeroFillAmount = new BigNumber(0);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, zeroFillAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.ORDER_REMAINING_FILL_AMOUNT_ZERO);
+ )).to.be.rejectedWith(ExchangeContractErrs.OrderRemainingFillAmountZero);
});
it('should throw when sender is not a taker', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
@@ -192,7 +192,7 @@ describe('ExchangeWrapper', () => {
const nonTakerAddress = userAddresses[6];
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, nonTakerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER);
+ )).to.be.rejectedWith(ExchangeContractErrs.TransactionSenderIsNotFillOrderTaker);
});
it('should throw when order is expired', async () => {
const expirationInPast = new BigNumber(1496826058); // 7th Jun 2017
@@ -202,7 +202,7 @@ describe('ExchangeWrapper', () => {
);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.ORDER_FILL_EXPIRED);
+ )).to.be.rejectedWith(ExchangeContractErrs.OrderFillExpired);
});
describe('should throw when not enough balance or allowance to fulfill the order', () => {
const balanceToSubtractFromMaker = new BigNumber(3);
@@ -219,7 +219,7 @@ describe('ExchangeWrapper', () => {
);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_TAKER_BALANCE);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientTakerBalance);
});
it('should throw when taker allowance is less than fill amount', async () => {
const newAllowanceWhichIsLessThanFillAmount = fillTakerAmount.minus(lackingAllowance);
@@ -227,7 +227,7 @@ describe('ExchangeWrapper', () => {
newAllowanceWhichIsLessThanFillAmount);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_TAKER_ALLOWANCE);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientTakerAllowance);
});
it('should throw when maker balance is less than maker fill amount', async () => {
await zeroEx.token.transferAsync(
@@ -235,7 +235,7 @@ describe('ExchangeWrapper', () => {
);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_MAKER_BALANCE);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerBalance);
});
it('should throw when maker allowance is less than maker fill amount', async () => {
const newAllowanceWhichIsLessThanFillAmount = fillTakerAmount.minus(lackingAllowance);
@@ -243,7 +243,7 @@ describe('ExchangeWrapper', () => {
newAllowanceWhichIsLessThanFillAmount);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_MAKER_ALLOWANCE);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerAllowance);
});
});
it('should throw when there a rounding error would have occurred', async () => {
@@ -256,7 +256,7 @@ describe('ExchangeWrapper', () => {
const fillTakerAmountThatCausesRoundingError = new BigNumber(3);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmountThatCausesRoundingError, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.ORDER_FILL_ROUNDING_ERROR);
+ )).to.be.rejectedWith(ExchangeContractErrs.OrderFillRoundingError);
});
describe('should throw when not enough balance or allowance to pay fees', () => {
const makerFee = new BigNumber(2);
@@ -275,7 +275,7 @@ describe('ExchangeWrapper', () => {
);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_MAKER_FEE_BALANCE);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerFeeBalance);
});
it('should throw when maker doesn\'t have enough allowance to pay fees', async () => {
const newAllowanceWhichIsLessThanFees = makerFee.minus(1);
@@ -283,7 +283,7 @@ describe('ExchangeWrapper', () => {
newAllowanceWhichIsLessThanFees);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_MAKER_FEE_ALLOWANCE);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerFeeAllowance);
});
it('should throw when taker doesn\'t have enough balance to pay fees', async () => {
const balanceToSubtractFromTaker = new BigNumber(1);
@@ -292,7 +292,7 @@ describe('ExchangeWrapper', () => {
);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_TAKER_FEE_BALANCE);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientTakerFeeBalance);
});
it('should throw when taker doesn\'t have enough allowance to pay fees', async () => {
const newAllowanceWhichIsLessThanFees = makerFee.minus(1);
@@ -300,7 +300,7 @@ describe('ExchangeWrapper', () => {
newAllowanceWhichIsLessThanFees);
return expect(zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.INSUFFICIENT_TAKER_FEE_ALLOWANCE);
+ )).to.be.rejectedWith(ExchangeContractErrs.InsufficientTakerFeeAllowance);
});
});
});
@@ -491,7 +491,7 @@ describe('ExchangeWrapper', () => {
it('should throw when cancel amount is zero', async () => {
const zeroCancelAmount = new BigNumber(0);
return expect(zeroEx.exchange.cancelOrderAsync(signedOrder, zeroCancelAmount))
- .to.be.rejectedWith(ExchangeContractErrs.ORDER_CANCEL_AMOUNT_ZERO);
+ .to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
});
it('should throw when order is expired', async () => {
const expirationInPast = new BigNumber(1496826058); // 7th Jun 2017
@@ -501,12 +501,12 @@ describe('ExchangeWrapper', () => {
);
orderHashHex = ZeroEx.getOrderHashHex(expiredSignedOrder);
return expect(zeroEx.exchange.cancelOrderAsync(expiredSignedOrder, cancelAmount))
- .to.be.rejectedWith(ExchangeContractErrs.ORDER_CANCEL_EXPIRED);
+ .to.be.rejectedWith(ExchangeContractErrs.OrderCancelExpired);
});
it('should throw when order is already cancelled or filled', async () => {
await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount);
return expect(zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount))
- .to.be.rejectedWith(ExchangeContractErrs.ORDER_ALREADY_CANCELLED_OR_FILLED);
+ .to.be.rejectedWith(ExchangeContractErrs.OrderAlreadyCancelledOrFilled);
});
});
describe('successful cancels', () => {
@@ -552,7 +552,7 @@ describe('ExchangeWrapper', () => {
order: signedOrderWithDifferentMaker,
takerTokenCancelAmount: cancelAmount,
},
- ])).to.be.rejectedWith(ExchangeContractErrs.MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH);
+ ])).to.be.rejectedWith(ExchangeContractErrs.MultipleMakersInSingleCancelBatchDisallowed);
});
});
describe('successful batch cancels', () => {
diff --git a/test/token_wrapper_test.ts b/test/token_wrapper_test.ts
index 06e373bfa..19be27b93 100644
--- a/test/token_wrapper_test.ts
+++ b/test/token_wrapper_test.ts
@@ -64,15 +64,15 @@ describe('TokenWrapper', () => {
const toAddress = coinbase;
return expect(zeroEx.token.transferAsync(
token.address, fromAddress, toAddress, transferAmount,
- )).to.be.rejectedWith(ZeroExError.INSUFFICIENT_BALANCE_FOR_TRANSFER);
+ )).to.be.rejectedWith(ZeroExError.InsufficientBalanceForTransfer);
});
- it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
+ it('should throw a ContractDoesNotExist error for a non-existent token contract', async () => {
const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
const fromAddress = coinbase;
const toAddress = coinbase;
return expect(zeroEx.token.transferAsync(
nonExistentTokenAddress, fromAddress, toAddress, transferAmount,
- )).to.be.rejectedWith(ZeroExError.CONTRACT_DOES_NOT_EXIST);
+ )).to.be.rejectedWith(ZeroExError.ContractDoesNotExist);
});
});
describe('#transferFromAsync', () => {
@@ -97,7 +97,7 @@ describe('TokenWrapper', () => {
return expect(zeroEx.token.transferFromAsync(
token.address, fromAddress, toAddress, senderAddress, transferAmount,
- )).to.be.rejectedWith(ZeroExError.INSUFFICIENT_ALLOWANCE_FOR_TRANSFER);
+ )).to.be.rejectedWith(ZeroExError.InsufficientAllowanceForTransfer);
});
it('[regression] should fail to transfer tokens if set allowance for toAddress instead of senderAddress',
async () => {
@@ -108,7 +108,7 @@ describe('TokenWrapper', () => {
return expect(zeroEx.token.transferFromAsync(
token.address, fromAddress, toAddress, senderAddress, transferAmount,
- )).to.be.rejectedWith(ZeroExError.INSUFFICIENT_ALLOWANCE_FOR_TRANSFER);
+ )).to.be.rejectedWith(ZeroExError.InsufficientAllowanceForTransfer);
});
it('should fail to transfer tokens if fromAddress has insufficient balance', async () => {
const fromAddress = addressWithoutFunds;
@@ -124,7 +124,7 @@ describe('TokenWrapper', () => {
return expect(zeroEx.token.transferFromAsync(
token.address, fromAddress, toAddress, senderAddress, transferAmount,
- )).to.be.rejectedWith(ZeroExError.INSUFFICIENT_BALANCE_FOR_TRANSFER);
+ )).to.be.rejectedWith(ZeroExError.InsufficientBalanceForTransfer);
});
it('should successfully transfer tokens', async () => {
const fromAddress = coinbase;
@@ -140,12 +140,12 @@ describe('TokenWrapper', () => {
const postBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
return expect(postBalance).to.be.bignumber.equal(transferAmount);
});
- it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
+ it('should throw a ContractDoesNotExist error for a non-existent token contract', async () => {
const fromAddress = coinbase;
const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
return expect(zeroEx.token.transferFromAsync(
nonExistentTokenAddress, fromAddress, toAddress, senderAddress, new BigNumber(42),
- )).to.be.rejectedWith(ZeroExError.CONTRACT_DOES_NOT_EXIST);
+ )).to.be.rejectedWith(ZeroExError.ContractDoesNotExist);
});
});
describe('#getBalanceAsync', () => {
@@ -156,11 +156,11 @@ describe('TokenWrapper', () => {
const expectedBalance = new BigNumber('100000000000000000000000000');
return expect(balance).to.be.bignumber.equal(expectedBalance);
});
- it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
+ it('should throw a ContractDoesNotExist error for a non-existent token contract', async () => {
const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
const ownerAddress = coinbase;
return expect(zeroEx.token.getBalanceAsync(nonExistentTokenAddress, ownerAddress))
- .to.be.rejectedWith(ZeroExError.CONTRACT_DOES_NOT_EXIST);
+ .to.be.rejectedWith(ZeroExError.ContractDoesNotExist);
});
it('should return a balance of 0 for a non-existent owner address', async () => {
const token = tokens[0];
diff --git a/test/utils/token_utils.ts b/test/utils/token_utils.ts
index f4fa7ac31..60cf4527b 100644
--- a/test/utils/token_utils.ts
+++ b/test/utils/token_utils.ts
@@ -11,7 +11,7 @@ export class TokenUtils {
public getProtocolTokenOrThrow(): Token {
const zrxToken = _.find(this.tokens, {symbol: PROTOCOL_TOKEN_SYMBOL});
if (_.isUndefined(zrxToken)) {
- throw new Error(ZeroExError.ZRX_NOT_IN_TOKEN_REGISTRY);
+ throw new Error(ZeroExError.ZrxNotInTokenRegistry);
}
return zrxToken;
}