@ -74,7 +74,7 @@ describe('PortfolioCalculator', () => {
const activities : Activity [ ] = [
{
. . . activityDummyData ,
date : new Date ( '202 2-01-01') ,
date : new Date ( '202 3-01-01') , // Date in future
fee : 0 ,
quantity : 1 ,
SymbolProfile : {
@ -96,61 +96,12 @@ describe('PortfolioCalculator', () => {
userId : userDummyData.id
} ) ;
const portfolioSnapshot = await portfolioCalculator . computeSnapshot (
parseDate ( '2022-01-01' )
) ;
spy . mockRestore ( ) ;
expect ( portfolioSnapshot ) . toEqual ( {
currentValueInBaseCurrency : new Big ( '0' ) ,
errors : [ ] ,
grossPerformance : new Big ( '0' ) ,
grossPerformancePercentage : new Big ( '0' ) ,
grossPerformancePercentageWithCurrencyEffect : new Big ( '0' ) ,
grossPerformanceWithCurrencyEffect : new Big ( '0' ) ,
hasErrors : true ,
netPerformance : new Big ( '0' ) ,
netPerformancePercentage : new Big ( '0' ) ,
netPerformancePercentageWithCurrencyEffect : new Big ( '0' ) ,
netPerformanceWithCurrencyEffect : new Big ( '0' ) ,
positions : [
{
averagePrice : new Big ( '3000' ) ,
currency : 'USD' ,
dataSource : 'MANUAL' ,
dividend : new Big ( '0' ) ,
dividendInBaseCurrency : new Big ( '0' ) ,
fee : new Big ( '0' ) ,
firstBuyDate : '2022-01-01' ,
grossPerformance : null ,
grossPerformancePercentage : null ,
grossPerformancePercentageWithCurrencyEffect : null ,
grossPerformanceWithCurrencyEffect : null ,
investment : new Big ( '0' ) ,
investmentWithCurrencyEffect : new Big ( '0' ) ,
marketPrice : null ,
marketPriceInBaseCurrency : 3000 ,
netPerformance : null ,
netPerformancePercentage : null ,
netPerformancePercentageWithCurrencyEffect : null ,
netPerformanceWithCurrencyEffect : null ,
quantity : new Big ( '0' ) ,
symbol : '55196015-1365-4560-aa60-8751ae6d18f8' ,
tags : [ ] ,
timeWeightedInvestment : new Big ( '0' ) ,
timeWeightedInvestmentWithCurrencyEffect : new Big ( '0' ) ,
transactionCount : 1 ,
valueInBaseCurrency : new Big ( '0' )
}
] ,
totalFeesWithCurrencyEffect : new Big ( '0' ) ,
totalInterestWithCurrencyEffect : new Big ( '0' ) ,
totalInvestment : new Big ( '0' ) ,
totalInvestmentWithCurrencyEffect : new Big ( '0' ) ,
totalLiabilitiesWithCurrencyEffect : new Big ( '0' ) ,
totalValuablesWithCurrencyEffect : new Big ( '0' )
} ) ;
const liabilitiesInBaseCurrency =
await portfolioCalculator . getLiabilitiesInBaseCurrency ( ) ;
expect ( liabilitiesInBaseCurrency ) . toEqual ( new Big ( 3000 ) ) ;
} ) ;
} ) ;
} ) ;