|
|
@ -109,6 +109,12 @@ describe('PortfolioCalculator', () => { |
|
|
|
|
|
|
|
|
const portfolioSnapshot = await portfolioCalculator.computeSnapshot(); |
|
|
const portfolioSnapshot = await portfolioCalculator.computeSnapshot(); |
|
|
|
|
|
|
|
|
|
|
|
const historicalDataDates = portfolioSnapshot.historicalData.map( |
|
|
|
|
|
({ date }) => { |
|
|
|
|
|
return date; |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
const investments = portfolioCalculator.getInvestments(); |
|
|
const investments = portfolioCalculator.getInvestments(); |
|
|
|
|
|
|
|
|
const investmentsByMonth = portfolioCalculator.getInvestmentsByGroup({ |
|
|
const investmentsByMonth = portfolioCalculator.getInvestmentsByGroup({ |
|
|
@ -170,8 +176,12 @@ describe('PortfolioCalculator', () => { |
|
|
totalLiabilitiesWithCurrencyEffect: new Big('0') |
|
|
totalLiabilitiesWithCurrencyEffect: new Big('0') |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
expect(historicalDataDates).not.toContain('2021-01-01'); |
|
|
|
|
|
expect(historicalDataDates).not.toContain('2021-12-31'); |
|
|
|
|
|
|
|
|
expect(portfolioSnapshot.historicalData.at(-1)).toMatchObject( |
|
|
expect(portfolioSnapshot.historicalData.at(-1)).toMatchObject( |
|
|
expect.objectContaining({ |
|
|
expect.objectContaining({ |
|
|
|
|
|
date: '2021-12-18', |
|
|
netPerformance: 23.05, |
|
|
netPerformance: 23.05, |
|
|
netPerformanceInPercentage: 0.08437042459736457, |
|
|
netPerformanceInPercentage: 0.08437042459736457, |
|
|
netPerformanceInPercentageWithCurrencyEffect: 0.08437042459736457, |
|
|
netPerformanceInPercentageWithCurrencyEffect: 0.08437042459736457, |
|
|
|