From 375d667144e26253f8ff6b0ad1beb45d5b3ef228 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 27 Jun 2018 10:43:12 +0200 Subject: Move combinatorial fillOrder tests into the `fill_ordere` test file --- packages/contracts/test/exchange/fill_order.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'packages/contracts/test/exchange/fill_order.ts') diff --git a/packages/contracts/test/exchange/fill_order.ts b/packages/contracts/test/exchange/fill_order.ts index 60fe777c3..d65ab2f9a 100644 --- a/packages/contracts/test/exchange/fill_order.ts +++ b/packages/contracts/test/exchange/fill_order.ts @@ -1,4 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import * as _ from 'lodash'; import { chaiSetup } from '../../src/utils/chai_setup'; import { CoreCombinatorialUtils, coreCombinatorialUtilsFactoryAsync } from '../../src/utils/core_combinatorial_utils'; @@ -10,6 +11,7 @@ import { BalanceAmountScenario, ExpirationTimeSecondsScenario, FeeRecipientAddressScenario, + FillScenario, OrderAssetAmountScenario, TakerAssetFillAmountScenario, TakerScenario, @@ -62,6 +64,25 @@ describe('FillOrder Tests', () => { await blockchainLifecycle.revertAsync(); }); describe('fillOrder', () => { + const test = (fillScenarios: FillScenario[]) => { + _.forEach(fillScenarios, fillScenario => { + const orderScenario = fillScenario.orderScenario; + const description = `Combinatorial OrderFill: ${orderScenario.feeRecipientScenario} ${ + orderScenario.makerAssetAmountScenario + } ${orderScenario.takerAssetAmountScenario} ${orderScenario.makerFeeScenario} ${ + orderScenario.takerFeeScenario + } ${orderScenario.expirationTimeSecondsScenario} ${orderScenario.makerAssetDataScenario} ${ + orderScenario.takerAssetDataScenario + }`; + it(description, async () => { + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); + }); + }); + }; + + const allFillScenarios = CoreCombinatorialUtils.generateFillOrderCombinations(); + describe('Combinatorially generated fills orders', () => test(allFillScenarios)); + it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => { const fillScenario = { ...defaultFillScenario, -- cgit v1.2.3