aboutsummaryrefslogtreecommitdiffstats
path: root/test/exchange_wrapper_test.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-08-24 15:56:34 +0800
committerGitHub <noreply@github.com>2017-08-24 15:56:34 +0800
commite216f2ff6de9b2dd998c37c919b8786f7dff1101 (patch)
treeb6fc54d6a328cc4c307bcf95deea36a609c88b94 /test/exchange_wrapper_test.ts
parent18f2a93950500e3efec7ae25e32ff644ebb7efcc (diff)
parent8d6045c1d5737ff2e62f6f3b906cf639da1aa2ba (diff)
downloaddexon-sol-tools-e216f2ff6de9b2dd998c37c919b8786f7dff1101.tar
dexon-sol-tools-e216f2ff6de9b2dd998c37c919b8786f7dff1101.tar.gz
dexon-sol-tools-e216f2ff6de9b2dd998c37c919b8786f7dff1101.tar.bz2
dexon-sol-tools-e216f2ff6de9b2dd998c37c919b8786f7dff1101.tar.lz
dexon-sol-tools-e216f2ff6de9b2dd998c37c919b8786f7dff1101.tar.xz
dexon-sol-tools-e216f2ff6de9b2dd998c37c919b8786f7dff1101.tar.zst
dexon-sol-tools-e216f2ff6de9b2dd998c37c919b8786f7dff1101.zip
Merge pull request #128 from 0xProject/verifyOrder
Add implementation for public order validation functions
Diffstat (limited to 'test/exchange_wrapper_test.ts')
-rw-r--r--test/exchange_wrapper_test.ts83
1 files changed, 0 insertions, 83 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index a9c237d0e..080be774a 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -95,24 +95,6 @@ describe('ExchangeWrapper', () => {
});
});
describe('#fillOrKillOrderAsync', () => {
- describe('failed fillOrKill', () => {
- it('should throw if remaining fillAmount is less then the desired fillAmount', async () => {
- const fillableAmount = new BigNumber(5);
- const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
- makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount,
- );
- const tooLargeFillAmount = new BigNumber(7);
- const fillAmountDifference = tooLargeFillAmount.minus(fillableAmount);
- await zeroEx.token.transferAsync(takerTokenAddress, coinbase, takerAddress, fillAmountDifference);
- await zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, tooLargeFillAmount);
- await zeroEx.token.transferAsync(makerTokenAddress, coinbase, makerAddress, fillAmountDifference);
- await zeroEx.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, tooLargeFillAmount);
-
- return expect(zeroEx.exchange.fillOrKillOrderAsync(
- signedOrder, tooLargeFillAmount, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.InsufficientRemainingFillAmount);
- });
- });
describe('successful fills', () => {
it('should fill a valid order', async () => {
const fillableAmount = new BigNumber(5);
@@ -174,49 +156,6 @@ describe('ExchangeWrapper', () => {
takerTokenAddress = takerToken.address;
});
describe('#fillOrderAsync', () => {
- describe('failed fills', () => {
- it('should throw when the fill amount is zero', async () => {
- const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
- makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount,
- );
- const zeroFillAmount = new BigNumber(0);
- return expect(zeroEx.exchange.fillOrderAsync(
- signedOrder, zeroFillAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.OrderRemainingFillAmountZero);
- });
- it('should throw when sender is not a taker', async () => {
- const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
- makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount,
- );
- const nonTakerAddress = userAddresses[6];
- return expect(zeroEx.exchange.fillOrderAsync(
- signedOrder, fillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, nonTakerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.TransactionSenderIsNotFillOrderTaker);
- });
- it('should throw when order is expired', async () => {
- const expirationInPast = new BigNumber(1496826058); // 7th Jun 2017
- const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
- makerTokenAddress, takerTokenAddress, makerAddress, takerAddress,
- fillableAmount, expirationInPast,
- );
- return expect(zeroEx.exchange.fillOrderAsync(
- signedOrder, fillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.OrderFillExpired);
- });
- it('should throw when there a rounding error would have occurred', async () => {
- const makerAmount = new BigNumber(3);
- const takerAmount = new BigNumber(5);
- const signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync(
- makerTokenAddress, takerTokenAddress, makerAddress, takerAddress,
- makerAmount, takerAmount,
- );
- const fillTakerAmountThatCausesRoundingError = new BigNumber(3);
- return expect(zeroEx.exchange.fillOrderAsync(
- signedOrder, fillTakerAmountThatCausesRoundingError,
- shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
- )).to.be.rejectedWith(ExchangeContractErrs.OrderFillRoundingError);
- });
- });
describe('successful fills', () => {
it('should fill a valid order', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
@@ -403,28 +342,6 @@ describe('ExchangeWrapper', () => {
orderHashHex = ZeroEx.getOrderHashHex(signedOrder);
});
describe('#cancelOrderAsync', () => {
- describe('failed cancels', () => {
- 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.OrderCancelAmountZero);
- });
- it('should throw when order is expired', async () => {
- const expirationInPast = new BigNumber(1496826058); // 7th Jun 2017
- const expiredSignedOrder = await fillScenarios.createFillableSignedOrderAsync(
- makerTokenAddress, takerTokenAddress, makerAddress, takerAddress,
- fillableAmount, expirationInPast,
- );
- orderHashHex = ZeroEx.getOrderHashHex(expiredSignedOrder);
- return expect(zeroEx.exchange.cancelOrderAsync(expiredSignedOrder, cancelAmount))
- .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.OrderAlreadyCancelledOrFilled);
- });
- });
describe('successful cancels', () => {
it('should cancel an order', async () => {
await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount);