From 98405a39dbb870c1eb9f562afca4539602917c67 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 14 Jun 2018 10:40:17 +0200 Subject: Add ability to specify takerAssetFillAmount and taker scenarios as part of a FillScenario --- .../contracts/test/exchange/combinatorial_tests.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'packages/contracts/test/exchange') diff --git a/packages/contracts/test/exchange/combinatorial_tests.ts b/packages/contracts/test/exchange/combinatorial_tests.ts index 2870a22ed..fd9193d69 100644 --- a/packages/contracts/test/exchange/combinatorial_tests.ts +++ b/packages/contracts/test/exchange/combinatorial_tests.ts @@ -5,7 +5,7 @@ import { chaiSetup } from '../../src/utils/chai_setup'; import { CoreCombinatorialUtils, coreCombinatorialUtilsFactoryAsync } from '../../src/utils/core_combinatorial_utils'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; -import { OrderScenario } from '../../src/utils/types'; +import { FillScenario, OrderScenario, TakerAssetFillAmountScenario } from '../../src/utils/types'; chaiSetup.configure(); const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); @@ -26,8 +26,9 @@ describe('Combinatorial tests', () => { afterEach(async () => { await blockchainLifecycle.revertAsync(); }); - const test = (orderScenarios: OrderScenario[]) => { - _.forEach(orderScenarios, orderScenario => { + const test = (fillScenarios: FillScenario[]) => { + _.forEach(fillScenarios, fillScenario => { + const orderScenario = fillScenario.orderScenario; const description = `Combinatorial OrderFill: ${orderScenario.feeRecipientScenario} ${ orderScenario.makerAssetAmountScenario } ${orderScenario.takerAssetAmountScenario} ${orderScenario.makerFeeScenario} ${ @@ -36,13 +37,18 @@ describe('Combinatorial tests', () => { orderScenario.takerAssetDataScenario }`; it(description, async () => { - const order = coreCombinatorialUtils.orderFactory.generateOrder(orderScenario); - await coreCombinatorialUtils.testFillOrderScenarioAsync(order, provider); + await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); }); }); }; const allOrderScenarios = CoreCombinatorialUtils.generateOrderCombinations(); + const allFillScenarios = _.map(allOrderScenarios, orderScenario => { + return { + orderScenario, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount, + }; + }); - describe.only('Fills orders', () => test(allOrderScenarios)); + describe('Fills orders', () => test(allFillScenarios)); }); -- cgit v1.2.3