From 379e3c8667820cd47e3b9a505088c93031540fee Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Thu, 20 Oct 2022 20:55:10 +0200 Subject: [PATCH] Fix test --- ...culator-btcusd-buy-and-sell-partially.spec.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts b/apps/api/src/app/portfolio/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts index 812e14118..ddb46c9a3 100644 --- a/apps/api/src/app/portfolio/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts +++ b/apps/api/src/app/portfolio/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts @@ -72,10 +72,10 @@ describe('PortfolioCalculator', () => { currentValue: new Big('13657.2'), errors: [], grossPerformance: new Big('27172.74'), - grossPerformancePercentage: new Big('0'), // ? + grossPerformancePercentage: new Big('42.40043067128546016291'), hasErrors: false, netPerformance: new Big('27172.74'), - netPerformancePercentage: new Big('0'), // ? + netPerformancePercentage: new Big('42.40043067128546016291'), positions: [ { averagePrice: new Big('320.43'), @@ -83,10 +83,10 @@ describe('PortfolioCalculator', () => { dataSource: 'YAHOO', firstBuyDate: '2015-01-01', grossPerformance: new Big('27172.74'), - grossPerformancePercentage: new Big('0'), // ? + grossPerformancePercentage: new Big('42.40043067128546016291'), investment: new Big('320.43'), netPerformance: new Big('27172.74'), - netPerformancePercentage: new Big('0'), // ? + netPerformancePercentage: new Big('42.40043067128546016291'), marketPrice: 13657.2, quantity: new Big('1'), symbol: 'BTCUSD', @@ -97,13 +97,13 @@ describe('PortfolioCalculator', () => { }); expect(investments).toEqual([ - { date: '2022-03-07', investment: new Big('151.6') }, - { date: '2022-04-08', investment: new Big('75.8') } + { date: '2015-01-01', investment: new Big('640.86') }, + { date: '2017-12-31', investment: new Big('320.43') } ]); expect(investmentsByMonth).toEqual([ - { date: '2022-03-01', investment: new Big('151.6') }, - { date: '2022-04-01', investment: new Big('-85.73') } + { date: '2015-01-01', investment: new Big('640.86') }, + { date: '2017-12-01', investment: new Big('-14156.4') } ]); }); });