Skip to content

Commit

Permalink
[Capped decimal places for estimated returns to 4 digits][references
Browse files Browse the repository at this point in the history
issue #3]
  • Loading branch information
sacOO7 committed May 4, 2020
1 parent 9fa2939 commit 14ba6cc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lisk-dex-electron/src/tests/Utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ describe('Utils tests => ', () => {
${142} | ${0.48} | ${68.16} | ${bids} | ${EstimationStatus.MATCH}
${739.130434783} | ${0.23} | ${170} | ${bids} | ${EstimationStatus.MATCH}
${947.368421053} | ${0.19} | ${180} | ${bids} | ${EstimationStatus.MATCH}
${818.18181} | ${0.22} | ${180} | ${bids} | ${EstimationStatus.PARTIAL_MATCH}
${818.181818182} | ${0.22} | ${180} | ${bids} | ${EstimationStatus.PARTIAL_MATCH}
${327.868852459} | ${0.61} | ${0} | ${bids} | ${EstimationStatus.NO_MATCH}
${457.142857143} | ${0.35} | ${160} | ${bids} | ${EstimationStatus.MATCH}
${457.142857143} | ${0.35} | ${160} | ${bids} | ${EstimationStatus.PARTIAL_MATCH}
${1495.0166113} | ${0.602} | ${0} | ${bids} | ${EstimationStatus.NO_MATCH}
`('Should estimate $amountInLshForSell based on $lshPaidPerLsk to $estimatedReturnsInLsk', ({
`('Should estimate $sellerAmountInLshForSell based on $marketPriceInLsk to $estimatedReturnsInLsk', ({
buyerOrders, sellerAmountInLshForSell, marketPriceInLsk, estimatedReturnsInLsk, estimatedStatus,
}) => {
const actualEstimatedReturnsInLsk = estimatedReturnsForSeller(sellerAmountInLshForSell, marketPriceInLsk, buyerOrders);
expect(actualEstimatedReturnsInLsk.estimatedReturns).toBe(estimatedReturnsInLsk);
expect(actualEstimatedReturnsInLsk.estimatedReturns.toFixed(4)).toBe(estimatedReturnsInLsk.toFixed(4));
expect(actualEstimatedReturnsInLsk.status).toBe(estimatedStatus);
});

Expand All @@ -87,10 +87,10 @@ describe('Utils tests => ', () => {
${2845.25} | ${0.95} | ${2995} | ${asks} | ${EstimationStatus.MATCH}
${63.36} | ${0.88} | ${72} | ${asks} | ${EstimationStatus.MATCH}
${79.2} | ${0.88} | ${90} | ${asks} | ${EstimationStatus.PARTIAL_MATCH}
${76.244} | ${0.778} | ${0} | ${asks} | ${EstimationStatus.NO_MATCH}
${78} | ${0.78} | ${0} | ${asks} | ${EstimationStatus.NO_MATCH}
${974.86} | ${0.79} | ${0} | ${asks} | ${EstimationStatus.NO_MATCH}
`('Should estimate $amountInLskForSell based on $lskPaidPerLsh to $estimatedReturnsInLsh', ({
${76.244} | ${0.76} | ${0} | ${asks} | ${EstimationStatus.NO_MATCH}
${78} | ${0.56} | ${0} | ${asks} | ${EstimationStatus.NO_MATCH}
${974.86} | ${0.20} | ${0} | ${asks} | ${EstimationStatus.NO_MATCH}
`('Should estimate $buyerAmountInLskForSell based on $marketPriceInLsk to $estimatedLshCanBeBought', ({
sellerOrders, buyerAmountInLskForSell, marketPriceInLsk, estimatedLshCanBeBought, estimatedStatus,
}) => {
const actualLshCanBeBought = estimatedReturnsForBuyer(buyerAmountInLskForSell, marketPriceInLsk, sellerOrders);
Expand Down

0 comments on commit 14ba6cc

Please sign in to comment.