diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-13 22:14:48 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-13 22:14:48 +0800 |
commit | 45186b70ec446a42736dd99b947463b1e1569b59 (patch) | |
tree | 8586dbf21fd4801288e99e3f169b4508c4f3f9c2 /packages/contracts/test/exchange | |
parent | b4fead9606ecc9655b2038fcef1c75217752f67d (diff) | |
download | dexon-sol-tools-45186b70ec446a42736dd99b947463b1e1569b59.tar dexon-sol-tools-45186b70ec446a42736dd99b947463b1e1569b59.tar.gz dexon-sol-tools-45186b70ec446a42736dd99b947463b1e1569b59.tar.bz2 dexon-sol-tools-45186b70ec446a42736dd99b947463b1e1569b59.tar.lz dexon-sol-tools-45186b70ec446a42736dd99b947463b1e1569b59.tar.xz dexon-sol-tools-45186b70ec446a42736dd99b947463b1e1569b59.tar.zst dexon-sol-tools-45186b70ec446a42736dd99b947463b1e1569b59.zip |
Move orderFill combinatorialTests to exchange folder
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r-- | packages/contracts/test/exchange/combinatorial_tests.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/contracts/test/exchange/combinatorial_tests.ts b/packages/contracts/test/exchange/combinatorial_tests.ts new file mode 100644 index 000000000..2870a22ed --- /dev/null +++ b/packages/contracts/test/exchange/combinatorial_tests.ts @@ -0,0 +1,48 @@ +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'; +import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; + +import { OrderScenario } from '../../src/utils/types'; + +chaiSetup.configure(); +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + +describe('Combinatorial tests', () => { + let coreCombinatorialUtils: CoreCombinatorialUtils; + + before(async () => { + await blockchainLifecycle.startAsync(); + coreCombinatorialUtils = await coreCombinatorialUtilsFactoryAsync(web3Wrapper, txDefaults); + }); + after(async () => { + await blockchainLifecycle.revertAsync(); + }); + beforeEach(async () => { + await blockchainLifecycle.startAsync(); + }); + afterEach(async () => { + await blockchainLifecycle.revertAsync(); + }); + const test = (orderScenarios: OrderScenario[]) => { + _.forEach(orderScenarios, orderScenario => { + const description = `Combinatorial OrderFill: ${orderScenario.feeRecipientScenario} ${ + orderScenario.makerAssetAmountScenario + } ${orderScenario.takerAssetAmountScenario} ${orderScenario.makerFeeScenario} ${ + orderScenario.takerFeeScenario + } ${orderScenario.expirationTimeSecondsScenario} ${orderScenario.makerAssetDataScenario} ${ + orderScenario.takerAssetDataScenario + }`; + it(description, async () => { + const order = coreCombinatorialUtils.orderFactory.generateOrder(orderScenario); + await coreCombinatorialUtils.testFillOrderScenarioAsync(order, provider); + }); + }); + }; + + const allOrderScenarios = CoreCombinatorialUtils.generateOrderCombinations(); + + describe.only('Fills orders', () => test(allOrderScenarios)); +}); |