|
|
@ -9,6 +9,7 @@ describe('MarketDataService', () => { |
|
|
marketData: { |
|
|
marketData: { |
|
|
createMany: jest.Mock; |
|
|
createMany: jest.Mock; |
|
|
deleteMany: jest.Mock; |
|
|
deleteMany: jest.Mock; |
|
|
|
|
|
findMany: jest.Mock; |
|
|
upsert: jest.Mock; |
|
|
upsert: jest.Mock; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
@ -19,6 +20,7 @@ describe('MarketDataService', () => { |
|
|
marketData: { |
|
|
marketData: { |
|
|
createMany: jest.fn(), |
|
|
createMany: jest.fn(), |
|
|
deleteMany: jest.fn(), |
|
|
deleteMany: jest.fn(), |
|
|
|
|
|
findMany: jest.fn().mockResolvedValue([]), |
|
|
upsert: jest.fn().mockResolvedValue({}) |
|
|
upsert: jest.fn().mockResolvedValue({}) |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
@ -26,6 +28,26 @@ describe('MarketDataService', () => { |
|
|
marketDataService = new MarketDataService(prismaService as any); |
|
|
marketDataService = new MarketDataService(prismaService as any); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('getRange', () => { |
|
|
|
|
|
it('queries the symbols grouped by data source', async () => { |
|
|
|
|
|
await marketDataService.getRange({ |
|
|
|
|
|
assetProfileIdentifiers: [ |
|
|
|
|
|
{ dataSource: 'YAHOO', symbol: 'AAPL' }, |
|
|
|
|
|
{ dataSource: 'COINGECKO', symbol: 'bitcoin' }, |
|
|
|
|
|
{ dataSource: 'YAHOO', symbol: 'MSFT' } |
|
|
|
|
|
], |
|
|
|
|
|
dateQuery: { gte: parseDate('2026-01-01') } |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
expect( |
|
|
|
|
|
prismaService.marketData.findMany.mock.calls[0][0].where.OR |
|
|
|
|
|
).toEqual([ |
|
|
|
|
|
{ dataSource: 'YAHOO', symbol: { in: ['AAPL', 'MSFT'] } }, |
|
|
|
|
|
{ dataSource: 'COINGECKO', symbol: { in: ['bitcoin'] } } |
|
|
|
|
|
]); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
describe('updateMany', () => { |
|
|
describe('updateMany', () => { |
|
|
it('does not drop isCarriedForward', async () => { |
|
|
it('does not drop isCarriedForward', async () => { |
|
|
prismaService.$transaction.mockImplementation((promises) => { |
|
|
prismaService.$transaction.mockImplementation((promises) => { |
|
|
|