aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/test
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-17 06:16:49 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-17 06:16:49 +0800
commit466ec6b22a51f0a9d618f6091ce6f9f533118280 (patch)
tree433bf040b0e11666bb1429b569c941d5e677395b /packages/asset-buyer/test
parenta58771844366d5fd331e6b46a8de596d17fa6632 (diff)
downloaddexon-sol-tools-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar
dexon-sol-tools-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.gz
dexon-sol-tools-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.bz2
dexon-sol-tools-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.lz
dexon-sol-tools-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.xz
dexon-sol-tools-466ec6b22a51f0a9d618f6091ce6f9f533118280.tar.zst
dexon-sol-tools-466ec6b22a51f0a9d618f6091ce6f9f533118280.zip
Change LiquidityForAssetData to return a BigNumber instead of a number to avoid losing precision
Diffstat (limited to 'packages/asset-buyer/test')
-rw-r--r--packages/asset-buyer/test/asset_buyer_test.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/packages/asset-buyer/test/asset_buyer_test.ts b/packages/asset-buyer/test/asset_buyer_test.ts
index 9ed51f5e5..f117b4d7a 100644
--- a/packages/asset-buyer/test/asset_buyer_test.ts
+++ b/packages/asset-buyer/test/asset_buyer_test.ts
@@ -84,8 +84,8 @@ describe('AssetBuyer', () => {
const assetBuyer = new AssetBuyer(mockWeb3Provider.object, mockOrderProvider.object);
const liquidityResult = await assetBuyer.getLiquidityForAssetDataAsync(FAKE_ASSET_DATA);
expect(liquidityResult).to.deep.equal({
- tokensAvailableInBaseUnits: 0,
- ethValueAvailableInWei: 0,
+ tokensAvailableInBaseUnits: new BigNumber(0),
+ ethValueAvailableInWei: new BigNumber(0),
});
});
it('should return 0s when only other asset pair supported', async () => {
@@ -94,8 +94,8 @@ describe('AssetBuyer', () => {
const assetBuyer = new AssetBuyer(mockWeb3Provider.object, mockOrderProvider.object);
const liquidityResult = await assetBuyer.getLiquidityForAssetDataAsync(FAKE_ASSET_DATA);
expect(liquidityResult).to.deep.equal({
- tokensAvailableInBaseUnits: 0,
- ethValueAvailableInWei: 0,
+ tokensAvailableInBaseUnits: new BigNumber(0),
+ ethValueAvailableInWei: new BigNumber(0),
});
});
});
@@ -121,8 +121,8 @@ describe('AssetBuyer', () => {
remainingFillableMakerAssetAmounts: [],
};
const expectedResult = {
- tokensAvailableInBaseUnits: 0,
- ethValueAvailableInWei: 0,
+ tokensAvailableInBaseUnits: new BigNumber(0),
+ ethValueAvailableInWei: new BigNumber(0),
};
await expectLiquidityResult(
mockWeb3Provider.object,
@@ -142,8 +142,8 @@ describe('AssetBuyer', () => {
const expectedTokensAvailable = orders[0].makerAssetAmount.plus(orders[1].makerAssetAmount);
const expectedEthValueAvailable = orders[0].takerAssetAmount.plus(orders[1].takerAssetAmount);
const expectedResult = {
- tokensAvailableInBaseUnits: expectedTokensAvailable.toNumber(),
- ethValueAvailableInWei: expectedEthValueAvailable.toNumber(),
+ tokensAvailableInBaseUnits: expectedTokensAvailable,
+ ethValueAvailableInWei: expectedEthValueAvailable,
};
await expectLiquidityResult(
@@ -160,8 +160,8 @@ describe('AssetBuyer', () => {
remainingFillableMakerAssetAmounts: [baseUnitAmount(1)],
};
const expectedResult = {
- tokensAvailableInBaseUnits: baseUnitAmount(1).toNumber(),
- ethValueAvailableInWei: baseUnitAmount(0.5, WETH_DECIMALS).toNumber(),
+ tokensAvailableInBaseUnits: baseUnitAmount(1),
+ ethValueAvailableInWei: baseUnitAmount(0.5, WETH_DECIMALS),
};
await expectLiquidityResult(
@@ -178,8 +178,8 @@ describe('AssetBuyer', () => {
remainingFillableMakerAssetAmounts: [baseUnitAmount(1), baseUnitAmount(3)],
};
const expectedResult = {
- tokensAvailableInBaseUnits: baseUnitAmount(4).toNumber(),
- ethValueAvailableInWei: baseUnitAmount(3.5, WETH_DECIMALS).toNumber(),
+ tokensAvailableInBaseUnits: baseUnitAmount(4),
+ ethValueAvailableInWei: baseUnitAmount(3.5, WETH_DECIMALS),
};
await expectLiquidityResult(
@@ -196,8 +196,8 @@ describe('AssetBuyer', () => {
remainingFillableMakerAssetAmounts: [baseUnitAmount(0), baseUnitAmount(0)],
};
const expectedResult = {
- tokensAvailableInBaseUnits: baseUnitAmount(0).toNumber(),
- ethValueAvailableInWei: baseUnitAmount(0, WETH_DECIMALS).toNumber(),
+ tokensAvailableInBaseUnits: baseUnitAmount(0),
+ ethValueAvailableInWei: baseUnitAmount(0, WETH_DECIMALS),
};
await expectLiquidityResult(