diff --git a/apps/api/src/app/portfolio/current-rate.service.mock.ts b/apps/api/src/app/portfolio/current-rate.service.mock.ts index c91ed9d9a..9246ffc73 100644 --- a/apps/api/src/app/portfolio/current-rate.service.mock.ts +++ b/apps/api/src/app/portfolio/current-rate.service.mock.ts @@ -1,6 +1,7 @@ import { parseDate, resetHours } from '@ghostfolio/common/helper'; import { addDays, endOfDay, isBefore, isSameDay } from 'date-fns'; +import { GetValueObject } from './interfaces/get-value-object.interface'; import { GetValuesParams } from './interfaces/get-values-params.interface'; function mockGetValue(symbol: string, date: Date) { @@ -33,8 +34,11 @@ function mockGetValue(symbol: string, date: Date) { } export const CurrentRateServiceMock = { - getValues: ({ dataGatheringItems, dateQuery }: GetValuesParams) => { - const result = []; + getValues: ({ + dataGatheringItems, + dateQuery + }: GetValuesParams): Promise => { + const result: GetValueObject[] = []; if (dateQuery.lt) { for ( let date = resetHours(dateQuery.gte); @@ -44,8 +48,10 @@ export const CurrentRateServiceMock = { for (const dataGatheringItem of dataGatheringItems) { result.push({ date, - marketPrice: mockGetValue(dataGatheringItem.symbol, date) - .marketPrice, + marketPriceInBaseCurrency: mockGetValue( + dataGatheringItem.symbol, + date + ).marketPrice, symbol: dataGatheringItem.symbol }); } @@ -55,8 +61,10 @@ export const CurrentRateServiceMock = { for (const dataGatheringItem of dataGatheringItems) { result.push({ date, - marketPrice: mockGetValue(dataGatheringItem.symbol, date) - .marketPrice, + marketPriceInBaseCurrency: mockGetValue( + dataGatheringItem.symbol, + date + ).marketPrice, symbol: dataGatheringItem.symbol }); } diff --git a/apps/api/src/app/portfolio/current-rate.service.spec.ts b/apps/api/src/app/portfolio/current-rate.service.spec.ts index ca45483e1..653cdc7dc 100644 --- a/apps/api/src/app/portfolio/current-rate.service.spec.ts +++ b/apps/api/src/app/portfolio/current-rate.service.spec.ts @@ -4,6 +4,7 @@ import { MarketDataService } from '@ghostfolio/api/services/market-data.service' import { DataSource, MarketData } from '@prisma/client'; import { CurrentRateService } from './current-rate.service'; +import { GetValueObject } from './interfaces/get-value-object.interface'; jest.mock('@ghostfolio/api/services/market-data.service', () => { return { @@ -96,15 +97,15 @@ describe('CurrentRateService', () => { }, userCurrency: 'CHF' }) - ).toMatchObject([ + ).toMatchObject([ { date: undefined, - marketPrice: 1841.823902, + marketPriceInBaseCurrency: 1841.823902, symbol: 'AMZN' }, { date: undefined, - marketPrice: 1847.839966, + marketPriceInBaseCurrency: 1847.839966, symbol: 'AMZN' } ]);