Replace classes with interfaces in action.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from '@jest/globals';
|
||||
import 'dotenv/config';
|
||||
import { ActionDateOptions, ActionDateType, ActionFetchOptions, AlpacaExchange } from '../src/index';
|
||||
import { ActionDateType, AlpacaExchange } from '../src/index';
|
||||
import { createLogger, transports, format } from "winston";
|
||||
|
||||
const timeout = 10000;
|
||||
@ -39,9 +39,15 @@ 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 = new ActionFetchOptions(undefined, new ActionDateOptions(new Date("2023-10-23T13:30:28.163Z"), ActionDateType.On));
|
||||
const date = new Date("2023-10-23T13:30:28.163Z");
|
||||
|
||||
const response = await exchange.actionProvider.fetchActions(fetchOptions);
|
||||
const response = await exchange.actionProvider.fetchActions({
|
||||
pageSize: undefined,
|
||||
dateOptions: {
|
||||
date: date,
|
||||
dateType: ActionDateType.On
|
||||
}
|
||||
});
|
||||
|
||||
expect(response).toBeDefined();
|
||||
|
||||
@ -55,9 +61,9 @@ describe('Alpaca Tests', () => {
|
||||
expect(action.pricePerShare).toBeDefined();
|
||||
|
||||
expect(action.timestamp).toBeDefined();
|
||||
expect(action.timestamp.getFullYear()).toBe(2023);
|
||||
expect(action.timestamp.getMonth()).toBe(9);
|
||||
expect(action.timestamp.getDate()).toBe(23);
|
||||
expect(action.timestamp.getFullYear()).toBe(date.getFullYear());
|
||||
expect(action.timestamp.getMonth()).toBe(date.getMonth());
|
||||
expect(action.timestamp.getDate()).toBe(date.getDate());
|
||||
}
|
||||
}, timeout);
|
||||
});
|
||||
|
Reference in New Issue
Block a user