Closed ausrasul closed 5 years ago
So most of the tests are simply connecting to and endpoint, and pass after a successful connection.
The socket tests are (as you said) subscribing to price updates. They pass if a quote
event is received (which never occurs if the market is closed).
Lastly, there is the "full flow" test, which places an order, fetches it, edits it, and then finally deletes it. Clearly this is somewhat dangerous as in order to successfully place the order we must make sure that the limit price is in 15% range of the average price (more details here), but on the other hand we must also price it so that the order does not get filled.
This is the reason as to why Travis currently only performs linting and does not run the tests.
Thanks for explaining.
May I suggest testing the API (this repo) after market hours? see my argument:
For Socket, since the API role is to establish a price feed; without looking at the result construct (just passing it through), may be waiting for a quote event isn't necessary. The test could pass if the socket connects.
On the other hand, placing/editing/deleting an order is very important to verify it runs end to end (acceptable data objects) may be that should be tested as you do today.
So, can we consider changing socket test as mentioned above, and strictly run the test after market close?
Here is another argument (testing from my application's perspective):
Placing order: The API takes a fixed format json, so it is logical for my application to mock the API just to verify that the format is sound. The API already tested the order flow.
Price feed: The API verified the connection but it just passes the data structure, so my application should use the unmocked API to test the quote json object.
Therefore my tests should run on market hours, while API tests should run after hours.
What do you think?
When running
npm test
the test get stuck on testingavanza.subscribe
.I think this is because the test ran after the market was closed.
Can you explain how the tests works? do they put actual orders that risk being fulfilled?
Should one run the tests during a market session or after?