aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/order-utils/src/rate_utils.ts1
-rw-r--r--packages/order-utils/src/sorting_utils.ts2
-rw-r--r--packages/order-utils/test/rate_utils_test.ts2
-rw-r--r--packages/order-utils/test/sorting_utils_test.ts12
4 files changed, 6 insertions, 11 deletions
diff --git a/packages/order-utils/src/rate_utils.ts b/packages/order-utils/src/rate_utils.ts
index 72d11584a..e82c03873 100644
--- a/packages/order-utils/src/rate_utils.ts
+++ b/packages/order-utils/src/rate_utils.ts
@@ -1,7 +1,6 @@
import { schemas } from '@0xproject/json-schemas';
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
-import * as _ from 'lodash';
import { assert } from './assert';
import { constants } from './constants';
diff --git a/packages/order-utils/src/sorting_utils.ts b/packages/order-utils/src/sorting_utils.ts
index 8424060fc..f019aa4a8 100644
--- a/packages/order-utils/src/sorting_utils.ts
+++ b/packages/order-utils/src/sorting_utils.ts
@@ -37,7 +37,7 @@ export const sortingUtils = {
*/
sortFeeOrdersByFeeAdjustedRate(signedFeeOrders: SignedOrder[]): SignedOrder[] {
assert.doesConformToSchema('signedFeeOrders', signedFeeOrders, schemas.signedOrdersSchema);
- const rateCalculator = rateUtils.getFeeAdjustedRateOfFeeOrder;
+ const rateCalculator = rateUtils.getFeeAdjustedRateOfFeeOrder.bind(rateUtils);
const sortedOrders = sortOrders(signedFeeOrders, rateCalculator);
return sortedOrders;
},
diff --git a/packages/order-utils/test/rate_utils_test.ts b/packages/order-utils/test/rate_utils_test.ts
index b23a6467a..2e299c209 100644
--- a/packages/order-utils/test/rate_utils_test.ts
+++ b/packages/order-utils/test/rate_utils_test.ts
@@ -2,7 +2,7 @@ import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import 'mocha';
-import { constants, rateUtils } from '../src';
+import { rateUtils } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { testOrderFactory } from './utils/test_order_factory';
diff --git a/packages/order-utils/test/sorting_utils_test.ts b/packages/order-utils/test/sorting_utils_test.ts
index 5a33cb2ca..016432505 100644
--- a/packages/order-utils/test/sorting_utils_test.ts
+++ b/packages/order-utils/test/sorting_utils_test.ts
@@ -1,9 +1,8 @@
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
-import * as _ from 'lodash';
import 'mocha';
-import { constants, rateUtils, sortingUtils } from '../src';
+import { sortingUtils } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { testOrderFactory } from './utils/test_order_factory';
@@ -32,15 +31,12 @@ describe('sortingUtils', () => {
});
it('correctly sorts by fee adjusted rate when feeRate is Provided', async () => {
const orders = [testOrder1, testOrder2, testOrder3];
- const sortedOrders = sortingUtils.sortOrdersByFeeAdjustedRate(
- [testOrder1, testOrder2, testOrder3],
- feeRate,
- );
+ const sortedOrders = sortingUtils.sortOrdersByFeeAdjustedRate(orders, feeRate);
expect(sortedOrders).to.deep.equal([testOrder2, testOrder1, testOrder3]);
});
it('correctly sorts by fee adjusted rate when no feeRate is Provided', async () => {
const orders = [testOrder1, testOrder2, testOrder3];
- const sortedOrders = sortingUtils.sortOrdersByFeeAdjustedRate([testOrder1, testOrder2, testOrder3]);
+ const sortedOrders = sortingUtils.sortOrdersByFeeAdjustedRate(orders);
expect(sortedOrders).to.deep.equal([testOrder2, testOrder1, testOrder3]);
});
});
@@ -64,7 +60,7 @@ describe('sortingUtils', () => {
});
it('correctly sorts by fee adjusted rate', async () => {
const orders = [testOrder1, testOrder2, testOrder3];
- const sortedOrders = sortingUtils.sortFeeOrdersByFeeAdjustedRate([testOrder1, testOrder2, testOrder3]);
+ const sortedOrders = sortingUtils.sortFeeOrdersByFeeAdjustedRate(orders);
expect(sortedOrders).to.deep.equal([testOrder2, testOrder3, testOrder1]);
});
});