(
label: string,
actual: OHLCDataPoint,
expected: { timestamp: number; open: number; close: number; low: number; high: number },
)
| 24 | |
| 25 | // Helper to compare OHLC values (works for both tuple and object) |
| 26 | const assertOHLCEqual = ( |
| 27 | label: string, |
| 28 | actual: OHLCDataPoint, |
| 29 | expected: { timestamp: number; open: number; close: number; low: number; high: number }, |
| 30 | ): void => { |
| 31 | if (Array.isArray(actual)) { |
| 32 | // Tuple format: [timestamp, open, close, low, high] |
| 33 | assertEqual(`${label} timestamp`, actual[0], expected.timestamp); |
| 34 | assertEqual(`${label} open`, actual[1], expected.open); |
| 35 | assertEqual(`${label} close`, actual[2], expected.close); |
| 36 | assertEqual(`${label} low`, actual[3], expected.low); |
| 37 | assertEqual(`${label} high`, actual[4], expected.high); |
| 38 | } else { |
| 39 | // Object format |
| 40 | assertEqual(`${label} timestamp`, actual.timestamp, expected.timestamp); |
| 41 | assertEqual(`${label} open`, actual.open, expected.open); |
| 42 | assertEqual(`${label} close`, actual.close, expected.close); |
| 43 | assertEqual(`${label} low`, actual.low, expected.low); |
| 44 | assertEqual(`${label} high`, actual.high, expected.high); |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | // ============================================================================= |
| 49 | // 1. TUPLE INPUT TESTS |
no test coverage detected