|
@ -18,22 +18,26 @@ jest.mock('./market-data.service', () => { |
|
|
marketPrice: 1847.839966 |
|
|
marketPrice: 1847.839966 |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
getRange: ( |
|
|
getRange: ({ |
|
|
dateRangeEnd: Date, |
|
|
dateRangeEnd, |
|
|
dateRangeStart: Date, |
|
|
dateRangeStart, |
|
|
symbol: string |
|
|
symbols |
|
|
) => { |
|
|
}: { |
|
|
|
|
|
dateRangeEnd: Date; |
|
|
|
|
|
dateRangeStart: Date; |
|
|
|
|
|
symbols: string[]; |
|
|
|
|
|
}) => { |
|
|
return Promise.resolve<MarketData[]>([ |
|
|
return Promise.resolve<MarketData[]>([ |
|
|
{ |
|
|
{ |
|
|
date: dateRangeStart, |
|
|
date: dateRangeStart, |
|
|
symbol, |
|
|
symbol: symbols[0], |
|
|
createdAt: dateRangeStart, |
|
|
createdAt: dateRangeStart, |
|
|
id: '8fa48fde-f397-4b0d-adbc-fb940e830e6d', |
|
|
id: '8fa48fde-f397-4b0d-adbc-fb940e830e6d', |
|
|
marketPrice: 1841.823902 |
|
|
marketPrice: 1841.823902 |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
date: dateRangeEnd, |
|
|
date: dateRangeEnd, |
|
|
symbol, |
|
|
symbol: symbols[0], |
|
|
createdAt: dateRangeEnd, |
|
|
createdAt: dateRangeEnd, |
|
|
id: '082d6893-df27-4c91-8a5d-092e84315b56', |
|
|
id: '082d6893-df27-4c91-8a5d-092e84315b56', |
|
|
marketPrice: 1847.839966 |
|
|
marketPrice: 1847.839966 |
|
@ -45,7 +49,7 @@ jest.mock('./market-data.service', () => { |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
jest.mock('../../services/exchange-rate-data.service', () => { |
|
|
jest.mock('@ghostfolio/api/services/exchange-rate-data.service', () => { |
|
|
return { |
|
|
return { |
|
|
ExchangeRateDataService: jest.fn().mockImplementation(() => { |
|
|
ExchangeRateDataService: jest.fn().mockImplementation(() => { |
|
|
return { |
|
|
return { |
|
@ -101,10 +105,10 @@ describe('CurrentRateService', () => { |
|
|
it('getValues', async () => { |
|
|
it('getValues', async () => { |
|
|
expect( |
|
|
expect( |
|
|
await currentRateService.getValues({ |
|
|
await currentRateService.getValues({ |
|
|
currency: Currency.USD, |
|
|
currencies: { AMZN: Currency.USD }, |
|
|
dateRangeEnd: new Date(Date.UTC(2020, 0, 2, 0, 0, 0)), |
|
|
dateRangeEnd: new Date(Date.UTC(2020, 0, 2, 0, 0, 0)), |
|
|
dateRangeStart: new Date(Date.UTC(2020, 0, 1, 0, 0, 0)), |
|
|
dateRangeStart: new Date(Date.UTC(2020, 0, 1, 0, 0, 0)), |
|
|
symbol: 'AMZN', |
|
|
symbols: ['AMZN'], |
|
|
userCurrency: Currency.CHF |
|
|
userCurrency: Currency.CHF |
|
|
}) |
|
|
}) |
|
|
).toMatchObject([ |
|
|
).toMatchObject([ |
|
|