import { describe, expect, test } from '@jest/globals'; import 'dotenv/config' import { AlpacaExchange } from '../src/alpaca/exchange' import { createLogger, transports, format } from "winston"; const logger = createLogger({ transports: [new transports.Console()], format: format.combine( format.colorize(), format.timestamp(), format.printf(({ timestamp, level, message, service }) => { return `[${timestamp}] ${service} ${level}: ${message}`; }) ), defaultMeta: { service: "AlpacaTest", }, }); describe('Alpaca Tests', () => { test('portfolio fetch', () => { expect(process.env.ALPACA_API_KEY).toBeDefined(); expect(process.env.ALPACA_SECRET_KEY).toBeDefined(); let exchange = new AlpacaExchange(process.env.ALPACA_API_KEY!, process.env.ALPACA_SECRET_KEY!, true); expect(exchange.portfolioProvider.fetchPortfolio()).resolves; }); test('quote fetch', async () => { expect(process.env.ALPACA_API_KEY).toBeDefined(); expect(process.env.ALPACA_SECRET_KEY).toBeDefined(); let exchange = new AlpacaExchange(process.env.ALPACA_API_KEY!, process.env.ALPACA_SECRET_KEY!, true); expect(exchange.quoteProvider.fetchQuote("AAPL")).resolves; }); });