11import fs from 'node:fs' ;
22import yaml from 'js-yaml' ;
33import { afterEach , describe , expect , it , vi } from 'vitest' ;
4- import { executePipeline } from '../../pipeline.js' ;
4+ import { executePipeline } from '../../pipeline/index.js' ;
5+
6+ type BinanceRow = Record < string , unknown > ;
57
68function loadPipeline ( name : string ) : any [ ] {
79 const file = new URL ( `./${ name } .yaml` , import . meta. url ) ;
@@ -11,6 +13,9 @@ function loadPipeline(name: string): any[] {
1113
1214function mockJsonOnce ( payload : unknown ) {
1315 vi . stubGlobal ( 'fetch' , vi . fn ( ) . mockResolvedValue ( {
16+ ok : true ,
17+ status : 200 ,
18+ statusText : 'OK' ,
1419 json : vi . fn ( ) . mockResolvedValue ( payload ) ,
1520 } ) ) ;
1621}
@@ -28,7 +33,7 @@ describe('binance YAML adapters', () => {
2833 { symbol : 'MID' , lastPrice : '3' , priceChangePercent : '3.4' , highPrice : '3' , lowPrice : '3' , quoteVolume : '11.0' } ,
2934 ] ) ;
3035
31- const result = await executePipeline ( null , loadPipeline ( 'top' ) , { args : { limit : 3 } } ) ;
36+ const result = await executePipeline ( null , loadPipeline ( 'top' ) , { args : { limit : 3 } } ) as BinanceRow [ ] ;
3237
3338 expect ( result . map ( ( item : any ) => item . symbol ) ) . toEqual ( [ 'LARGE' , 'MID' , 'SMALL' ] ) ;
3439 expect ( result . map ( ( item : any ) => item . rank ) ) . toEqual ( [ 1 , 2 , 3 ] ) ;
@@ -41,7 +46,7 @@ describe('binance YAML adapters', () => {
4146 { symbol : 'HUNDRED' , lastPrice : '1' , priceChangePercent : '100.0' , quoteVolume : '100' } ,
4247 ] ) ;
4348
44- const result = await executePipeline ( null , loadPipeline ( 'gainers' ) , { args : { limit : 3 } } ) ;
49+ const result = await executePipeline ( null , loadPipeline ( 'gainers' ) , { args : { limit : 3 } } ) as BinanceRow [ ] ;
4550
4651 expect ( result . map ( ( item : any ) => item . symbol ) ) . toEqual ( [ 'HUNDRED' , 'TEN' , 'NINE' ] ) ;
4752 } ) ;
@@ -54,7 +59,7 @@ describe('binance YAML adapters', () => {
5459 ] ,
5560 } ) ;
5661
57- const result = await executePipeline ( null , loadPipeline ( 'pairs' ) , { args : { limit : 10 } } ) ;
62+ const result = await executePipeline ( null , loadPipeline ( 'pairs' ) , { args : { limit : 10 } } ) as BinanceRow [ ] ;
5863
5964 expect ( result ) . toEqual ( [
6065 { symbol : 'BTCUSDT' , base : 'BTC' , quote : 'USDT' , status : 'TRADING' } ,
0 commit comments