Update alpaca actions test to test date.

This commit is contained in:
Carter Bertolini 2023-11-03 21:19:31 -04:00
parent 34bcafb07f
commit 960285e503

View File

@ -1,6 +1,6 @@
import { describe, expect, test } from '@jest/globals';
import 'dotenv/config';
import { ActionFetchOptions, AlpacaExchange } from '../src/index';
import { ActionDateOptions, ActionDateType, ActionFetchOptions, AlpacaExchange } from '../src/index';
import { createLogger, transports, format } from "winston";
const timeout = 10000;
@ -39,12 +39,12 @@ describe('Alpaca Tests', () => {
expect(process.env.ALPACA_SECRET_KEY).toBeDefined();
const exchange = new AlpacaExchange(process.env.ALPACA_API_KEY!, process.env.ALPACA_SECRET_KEY!, true);
const fetchOptions = {};
const fetchOptions = new ActionFetchOptions(undefined, new ActionDateOptions(new Date("2023-10-23T13:30:28.163Z"), ActionDateType.On));
const response = await exchange.actionProvider.fetchActions(new ActionFetchOptions());
const response = await exchange.actionProvider.fetchActions(fetchOptions);
logger.info(JSON.stringify(response));
await expect(exchange.actionProvider.fetchActions(new ActionFetchOptions())).resolves.toBeDefined();
await expect(exchange.actionProvider.fetchActions(fetchOptions)).resolves.toBeDefined();
}, timeout);
});