diff --git a/src/clis/binance/commands.test.ts b/src/clis/binance/commands.test.ts index a16b146b..92b6b667 100644 --- a/src/clis/binance/commands.test.ts +++ b/src/clis/binance/commands.test.ts @@ -1,7 +1,9 @@ import fs from 'node:fs'; import yaml from 'js-yaml'; import { afterEach, describe, expect, it, vi } from 'vitest'; -import { executePipeline } from '../../pipeline.js'; +import { executePipeline } from '../../pipeline/index.js'; + +type BinanceRow = Record; function loadPipeline(name: string): any[] { const file = new URL(`./${name}.yaml`, import.meta.url); @@ -11,6 +13,9 @@ function loadPipeline(name: string): any[] { function mockJsonOnce(payload: unknown) { vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ + ok: true, + status: 200, + statusText: 'OK', json: vi.fn().mockResolvedValue(payload), })); } @@ -28,7 +33,7 @@ describe('binance YAML adapters', () => { { symbol: 'MID', lastPrice: '3', priceChangePercent: '3.4', highPrice: '3', lowPrice: '3', quoteVolume: '11.0' }, ]); - const result = await executePipeline(null, loadPipeline('top'), { args: { limit: 3 } }); + const result = await executePipeline(null, loadPipeline('top'), { args: { limit: 3 } }) as BinanceRow[]; expect(result.map((item: any) => item.symbol)).toEqual(['LARGE', 'MID', 'SMALL']); expect(result.map((item: any) => item.rank)).toEqual([1, 2, 3]); @@ -41,7 +46,7 @@ describe('binance YAML adapters', () => { { symbol: 'HUNDRED', lastPrice: '1', priceChangePercent: '100.0', quoteVolume: '100' }, ]); - const result = await executePipeline(null, loadPipeline('gainers'), { args: { limit: 3 } }); + const result = await executePipeline(null, loadPipeline('gainers'), { args: { limit: 3 } }) as BinanceRow[]; expect(result.map((item: any) => item.symbol)).toEqual(['HUNDRED', 'TEN', 'NINE']); }); @@ -54,7 +59,7 @@ describe('binance YAML adapters', () => { ], }); - const result = await executePipeline(null, loadPipeline('pairs'), { args: { limit: 10 } }); + const result = await executePipeline(null, loadPipeline('pairs'), { args: { limit: 10 } }) as BinanceRow[]; expect(result).toEqual([ { symbol: 'BTCUSDT', base: 'BTC', quote: 'USDT', status: 'TRADING' },