|
|
@ -9,6 +9,8 @@ import { |
|
|
|
} from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator.factory'; |
|
|
|
import { CurrentRateService } from '@ghostfolio/api/app/portfolio/current-rate.service'; |
|
|
|
import { CurrentRateServiceMock } from '@ghostfolio/api/app/portfolio/current-rate.service.mock'; |
|
|
|
import { RedisCacheService } from '@ghostfolio/api/app/redis-cache/redis-cache.service'; |
|
|
|
import { RedisCacheServiceMock } from '@ghostfolio/api/app/redis-cache/redis-cache.service.mock'; |
|
|
|
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; |
|
|
|
import { ExchangeRateDataServiceMock } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service.mock'; |
|
|
|
import { parseDate } from '@ghostfolio/common/helper'; |
|
|
@ -24,6 +26,15 @@ jest.mock('@ghostfolio/api/app/portfolio/current-rate.service', () => { |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
jest.mock('@ghostfolio/api/app/redis-cache/redis-cache.service', () => { |
|
|
|
return { |
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
RedisCacheService: jest.fn().mockImplementation(() => { |
|
|
|
return RedisCacheServiceMock; |
|
|
|
}) |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
jest.mock( |
|
|
|
'@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service', |
|
|
|
() => { |
|
|
@ -40,6 +51,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
let currentRateService: CurrentRateService; |
|
|
|
let exchangeRateDataService: ExchangeRateDataService; |
|
|
|
let factory: PortfolioCalculatorFactory; |
|
|
|
let redisCacheService: RedisCacheService; |
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
currentRateService = new CurrentRateService(null, null, null, null); |
|
|
@ -51,9 +63,12 @@ describe('PortfolioCalculator', () => { |
|
|
|
null |
|
|
|
); |
|
|
|
|
|
|
|
redisCacheService = new RedisCacheService(null, null); |
|
|
|
|
|
|
|
factory = new PortfolioCalculatorFactory( |
|
|
|
currentRateService, |
|
|
|
exchangeRateDataService |
|
|
|
exchangeRateDataService, |
|
|
|
redisCacheService |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|