feat: Crypto.com-Client und Backfill-Script
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
21
src/server/market/cryptocom.test.ts
Normal file
21
src/server/market/cryptocom.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { expect, test } from 'bun:test';
|
||||
import { parseCandlestickResponse } from './cryptocom';
|
||||
|
||||
test('parst Crypto.com-Candlestick-Response', () => {
|
||||
const json = {
|
||||
result: {
|
||||
data: [
|
||||
{ t: 900000, o: '1.0', h: '1.2', l: '0.9', c: '1.1', v: '1000' },
|
||||
{ t: 1800000, o: '1.1', h: '1.3', l: '1.0', c: '1.2', v: '500' },
|
||||
],
|
||||
},
|
||||
};
|
||||
const out = parseCandlestickResponse(json);
|
||||
expect(out).toHaveLength(2);
|
||||
expect(out[0]).toEqual({ ts: 900000, open: 1, high: 1.2, low: 0.9, close: 1.1, volume: 1000 });
|
||||
});
|
||||
|
||||
test('leere/fehlende Daten → leeres Array', () => {
|
||||
expect(parseCandlestickResponse({})).toEqual([]);
|
||||
expect(parseCandlestickResponse({ result: {} })).toEqual([]);
|
||||
});
|
||||
Reference in New Issue
Block a user