|
|
@ -41,22 +41,40 @@ describe('BenchmarksService in a time zone behind UTC', () => { |
|
|
); |
|
|
); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
it('returns the dates of the market data without a shift', async () => { |
|
|
describe('getMarketDataForUser', () => { |
|
|
await expect( |
|
|
const getMarketDataForUser = ({ |
|
|
benchmarksService.getMarketDataForUser({ |
|
|
endDate = parseDate('2010-07-19') |
|
|
|
|
|
}: { endDate?: Date } = {}) => { |
|
|
|
|
|
return benchmarksService.getMarketDataForUser({ |
|
|
|
|
|
endDate, |
|
|
dataSource: DataSource.COINGECKO, |
|
|
dataSource: DataSource.COINGECKO, |
|
|
dateRange: 'max', |
|
|
dateRange: 'max', |
|
|
endDate: parseDate('2010-07-19'), |
|
|
|
|
|
startDate: parseDate('2010-07-18'), |
|
|
startDate: parseDate('2010-07-18'), |
|
|
symbol: 'bitcoin', |
|
|
symbol: 'bitcoin', |
|
|
userId: 'user-id', |
|
|
userId: 'user-id', |
|
|
userSettings: { baseCurrency: 'USD' } |
|
|
userSettings: { baseCurrency: 'USD' } |
|
|
}) |
|
|
}); |
|
|
).resolves.toEqual({ |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
it('returns the dates of the market data without a shift', async () => { |
|
|
|
|
|
await expect(getMarketDataForUser()).resolves.toEqual({ |
|
|
marketData: [ |
|
|
marketData: [ |
|
|
{ date: '2010-07-18', value: 0 }, |
|
|
{ date: '2010-07-18', value: 0 }, |
|
|
{ date: '2010-07-19', value: 100 } |
|
|
{ date: '2010-07-19', value: 100 } |
|
|
] |
|
|
] |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('returns the end date after the market data without a shift', async () => { |
|
|
|
|
|
await expect( |
|
|
|
|
|
getMarketDataForUser({ endDate: parseDate('2010-07-20') }) |
|
|
|
|
|
).resolves.toEqual({ |
|
|
|
|
|
marketData: [ |
|
|
|
|
|
{ date: '2010-07-18', value: 0 }, |
|
|
|
|
|
{ date: '2010-07-19', value: 100 }, |
|
|
|
|
|
{ date: '2010-07-20', value: 300 } |
|
|
|
|
|
] |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|