diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-03 06:47:29 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-06 06:33:52 +0800 |
commit | bc5f8e52de9dfe920ce1d0e6b44c90a5a5826cbe (patch) | |
tree | ea9083db84830344632efcb307f15b1465e40f09 /packages/order-utils/test/utils | |
parent | 09c0fc94fc91134acfdee1017d7a50e2047b019b (diff) | |
download | dexon-sol-tools-bc5f8e52de9dfe920ce1d0e6b44c90a5a5826cbe.tar dexon-sol-tools-bc5f8e52de9dfe920ce1d0e6b44c90a5a5826cbe.tar.gz dexon-sol-tools-bc5f8e52de9dfe920ce1d0e6b44c90a5a5826cbe.tar.bz2 dexon-sol-tools-bc5f8e52de9dfe920ce1d0e6b44c90a5a5826cbe.tar.lz dexon-sol-tools-bc5f8e52de9dfe920ce1d0e6b44c90a5a5826cbe.tar.xz dexon-sol-tools-bc5f8e52de9dfe920ce1d0e6b44c90a5a5826cbe.tar.zst dexon-sol-tools-bc5f8e52de9dfe920ce1d0e6b44c90a5a5826cbe.zip |
Change orderStates param name to remaingFillableMakerAssetAmounts
Diffstat (limited to 'packages/order-utils/test/utils')
-rw-r--r-- | packages/order-utils/test/utils/test_order_factory.ts | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/packages/order-utils/test/utils/test_order_factory.ts b/packages/order-utils/test/utils/test_order_factory.ts index 2c5d8cf61..611e777ea 100644 --- a/packages/order-utils/test/utils/test_order_factory.ts +++ b/packages/order-utils/test/utils/test_order_factory.ts @@ -1,5 +1,4 @@ -import { Order, OrderRelevantState, SignedOrder } from '@0xproject/types'; -import { BigNumber } from '@0xproject/utils'; +import { Order, SignedOrder } from '@0xproject/types'; import * as _ from 'lodash'; import { constants, orderFactory } from '../../src'; @@ -21,43 +20,18 @@ const BASE_TEST_SIGNED_ORDER: SignedOrder = { ...BASE_TEST_ORDER, signature: constants.NULL_BYTES, }; -const BASE_TEST_ORDER_RELEVANT_STATE: OrderRelevantState = { - makerBalance: constants.ZERO_AMOUNT, - makerProxyAllowance: constants.ZERO_AMOUNT, - makerFeeBalance: constants.ZERO_AMOUNT, - makerFeeProxyAllowance: constants.ZERO_AMOUNT, - filledTakerAssetAmount: constants.ZERO_AMOUNT, - remainingFillableMakerAssetAmount: constants.ZERO_AMOUNT, - remainingFillableTakerAssetAmount: constants.ZERO_AMOUNT, -}; export const testOrderFactory = { generateTestSignedOrder(partialOrder: Partial<SignedOrder>): SignedOrder { return transformObject(BASE_TEST_SIGNED_ORDER, partialOrder); }, generateTestSignedOrders(partialOrder: Partial<SignedOrder>, numOrders: number): SignedOrder[] { - const baseTestOrders = generateArrayOfInput(BASE_TEST_SIGNED_ORDER, numOrders); - return transformObjects(baseTestOrders, partialOrder); - }, - generateTestOrderRelevantState(partialOrderRelevantState: Partial<OrderRelevantState>): OrderRelevantState { - return transformObject(BASE_TEST_ORDER_RELEVANT_STATE, partialOrderRelevantState); - }, - generateTestOrderRelevantStates( - partialOrderRelevantState: Partial<OrderRelevantState>, - numOrderStates: number, - ): OrderRelevantState[] { - const baseTestOrderStates = generateArrayOfInput(BASE_TEST_ORDER_RELEVANT_STATE, numOrderStates); - return transformObjects(baseTestOrderStates, partialOrderRelevantState); + const baseTestOrders = _.map(_.range(numOrders), () => BASE_TEST_SIGNED_ORDER); + return _.map(baseTestOrders, order => transformObject(order, partialOrder)); }, }; -function generateArrayOfInput<T>(input: T, rangeLength: number): T[] { - return _.map(_.range(rangeLength), () => input); -} function transformObject<T>(input: T, transformation: Partial<T>): T { const copy = _.cloneDeep(input); return _.assign(copy, transformation); } -function transformObjects<T>(inputs: T[], transformation: Partial<T>): T[] { - return _.map(inputs, input => transformObject(input, transformation)); -} |