aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/test/rate_utils_test.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-10 06:59:29 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-10 07:12:42 +0800
commitaf52598d320462357d3ce40d37cf7de9a4f054ee (patch)
treec3d20ac2dd492167604a68828b0f75295ae6e801 /packages/order-utils/test/rate_utils_test.ts
parentcbe639866ec9d6088cc7aa133033d2735524c5a0 (diff)
downloaddexon-sol-tools-af52598d320462357d3ce40d37cf7de9a4f054ee.tar.gz
dexon-sol-tools-af52598d320462357d3ce40d37cf7de9a4f054ee.tar.zst
dexon-sol-tools-af52598d320462357d3ce40d37cf7de9a4f054ee.zip
Update tests for optional feeRate
Diffstat (limited to 'packages/order-utils/test/rate_utils_test.ts')
-rw-r--r--packages/order-utils/test/rate_utils_test.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/order-utils/test/rate_utils_test.ts b/packages/order-utils/test/rate_utils_test.ts
index 167a40465..b23a6467a 100644
--- a/packages/order-utils/test/rate_utils_test.ts
+++ b/packages/order-utils/test/rate_utils_test.ts
@@ -23,12 +23,18 @@ describe('rateUtils', () => {
'Expected feeRate: -1 to be greater than or equal to 0',
);
});
- it('correctly calculates fee adjusted rate', async () => {
+ it('correctly calculates fee adjusted rate when feeRate is provided', async () => {
const feeRate = new BigNumber(2); // ZRX costs 2 units of takerAsset per 1 unit of ZRX
const feeAdjustedRate = rateUtils.getFeeAdjustedRateOfOrder(testOrder, feeRate);
// the order actually takes 100 + (2 * 20) takerAsset units to fill 100 units of makerAsset
expect(feeAdjustedRate).to.bignumber.equal(new BigNumber(1.4));
});
+ it('correctly calculates fee adjusted rate when no feeRate is provided', async () => {
+ const feeAdjustedRate = rateUtils.getFeeAdjustedRateOfOrder(testOrder);
+ // because no feeRate was provided we just assume 0 fees
+ // the order actually takes 100 takerAsset units to fill 100 units of makerAsset
+ expect(feeAdjustedRate).to.bignumber.equal(new BigNumber(1));
+ });
});
describe('#getFeeAdjustedRateOfFeeOrder', () => {
it('throws when takerFee exceeds makerAssetAmount', async () => {