aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-27 16:43:12 +0800
committerFabio Berger <me@fabioberger.com>2018-06-27 16:43:12 +0800
commit375d667144e26253f8ff6b0ad1beb45d5b3ef228 (patch)
tree73b467f432ed809d6e5324340054ce7b06f4d962 /packages/contracts
parent6a2421c683d27b1ec5e2474341c92ae74e98644c (diff)
downloaddexon-sol-tools-375d667144e26253f8ff6b0ad1beb45d5b3ef228.tar
dexon-sol-tools-375d667144e26253f8ff6b0ad1beb45d5b3ef228.tar.gz
dexon-sol-tools-375d667144e26253f8ff6b0ad1beb45d5b3ef228.tar.bz2
dexon-sol-tools-375d667144e26253f8ff6b0ad1beb45d5b3ef228.tar.lz
dexon-sol-tools-375d667144e26253f8ff6b0ad1beb45d5b3ef228.tar.xz
dexon-sol-tools-375d667144e26253f8ff6b0ad1beb45d5b3ef228.tar.zst
dexon-sol-tools-375d667144e26253f8ff6b0ad1beb45d5b3ef228.zip
Move combinatorial fillOrder tests into the `fill_ordere` test file
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/test/exchange/combinatorial_tests.ts48
-rw-r--r--packages/contracts/test/exchange/fill_order.ts21
2 files changed, 21 insertions, 48 deletions
diff --git a/packages/contracts/test/exchange/combinatorial_tests.ts b/packages/contracts/test/exchange/combinatorial_tests.ts
deleted file mode 100644
index f5f795bbe..000000000
--- a/packages/contracts/test/exchange/combinatorial_tests.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-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 { FillScenario } 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 = (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('Fills orders', () => test(allFillScenarios));
-});
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,