"use strict";
/**
 * Bun Test Setup File for Stock Bot Trading Platform
 *
 * Global test configuration and utilities available across all tests.
 * This file is executed before each test via bunfig.toml preload.
 */
// Increase test timeout if needed (already configured in bunfig.toml)
// Bun.timeout = 30000; 
// Store original console methods to allow restoration
const originalConsole = global.console;
// Mock console methods to reduce noise during tests
// These can be restored with testHelpers.restoreConsole()
console.log = () => { };
console.debug = () => { };
console.info = () => { };
console.warn = () => { };
console.error = () => { };
global.testHelpers = {
    /**
     * Sleep utility for async tests
     */
    sleep: (ms) => new Promise(resolve => setTimeout(resolve, ms)),
    /**
     * Consistent mock timestamp for tests
     */
    mockTimestamp: () => new Date('2024-01-01T12:00:00Z'),
    /**
     * Generate test OHLCV data
     */
    generateTestOHLCV: (symbol = 'AAPL', overrides = {}) => ({
        symbol,
        open: 150.0,
        high: 153.0,
        low: 149.0,
        close: 152.5,
        volume: 10000,
        timestamp: global.testHelpers.mockTimestamp(),
        ...overrides
    }),
    /**
     * Generate test trade data
     */
    generateTestTrade: (symbol = 'AAPL', overrides = {}) => ({
        symbol,
        price: 152.5,
        size: 100,
        timestamp: global.testHelpers.mockTimestamp(),
        exchange: 'NASDAQ',
        conditions: ['@', 'T'],
        ...overrides
    }),
    /**
     * Generate test quote data
     */
    generateTestQuote: (symbol = 'AAPL', overrides = {}) => ({
        symbol,
        bidPrice: 152.45,
        bidSize: 200,
        askPrice: 152.55,
        askSize: 150,
        timestamp: global.testHelpers.mockTimestamp(),
        ...overrides
    }),
    /**
     * Create a mock logger
     */
    mockLogger: () => ({
        debug: () => { },
        info: () => { },
        warn: () => { },
        error: () => { },
        critical: () => { },
    }),
    /**
     * Restore console methods
     */
    restoreConsole: () => {
        global.console = originalConsole;
    }
};
// Set up spyOn utilities
// Similar to jest.spyOn but using Bun's built-in spy functionality
// This makes it easier to migrate from Jest
global.spyOn = function (object, method) {
    const original = object[method];
    const mock = function (...args) {
        mock.mock.calls.push(args);
        return mock.mockImplementation ? mock.mockImplementation(...args) : original.apply(object, args);
    };
    mock.mock = { calls: [] };
    mock.mockClear = () => { mock.mock.calls = []; return mock; };
    mock.mockReset = () => {
        mock.mock.calls = [];
        mock.mockImplementation = null;
        return mock;
    };
    mock.mockImplementation = null;
    mock.mockReturnValue = (value) => {
        mock.mockImplementation = () => value;
        return mock;
    };
    mock.mockResolvedValue = (value) => {
        return mock.mockReturnValue(Promise.resolve(value));
    };
    mock.mockRejectedValue = (value) => {
        return mock.mockReturnValue(Promise.reject(value));
    };
    object[method] = mock;
    return mock;
};
//# sourceMappingURL=setup.js.map