Use an interface for AlpacaActivity and add date checks to tests.

This commit is contained in:
2023-11-10 16:32:44 -05:00
parent 960285e503
commit ef1ee52a38
2 changed files with 27 additions and 14 deletions

View File

@ -43,8 +43,21 @@ describe('Alpaca Tests', () => {
const response = await exchange.actionProvider.fetchActions(fetchOptions);
expect(response).toBeDefined();
logger.info(JSON.stringify(response));
await expect(exchange.actionProvider.fetchActions(fetchOptions)).resolves.toBeDefined();
for (const action of response.actions) {
expect(action).toBeDefined();
expect(action.symbol).toBeDefined();
expect(action.quantity).toBeDefined();
expect(action.side).toBeDefined();
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);
}
}, timeout);
});