Open craysiii opened 6 years ago
I'd be willing to help make this happen. Are you able to send me your tests (privately)?. You can remove the creds of course.
Hey @cmer - sorry for the late response.
Unfortunately I lost my personal tests when I switched from developing on Windows to WSL. Stupid mistake. Anyway, feel free to start from scratch, or I can write up some basic stuff this weekend and we can build on that. I will ask that you use RSpec.
Quick question: Do you plan to mock? I have been eyeing VCR, doesn't really matter to me what you use though. I have implemented passing Faraday adapters to the REST API, so we can also pass Faraday::Adapter::Test::Stubs instances.
VCR is a waste of time as the client does not care about the responses, it returns raw json. It adds nothing if you write tests that expect the response to be what you told the webmock library to return. Then you're just testing the webmock library.
The gem does not try to convert string prices and quantities to floats or anything. You must do everything by yourself. It's just a list of endpoints and which security measures they require and what parameters are supported/required by it.
There's very little magic so also very little to test.
You can just stub the client calls and expect the client to be called with certain params if you want to write specs for the endpoint methods.
There are only a couple of things that should be tested:
1) the api key header gets sent 2) the timestamp is added 3) the requests are correctly signed
The http request internals are already tested in Faraday, no need to re-test. The websocket internals are already tested in Faye, no need to re-test.
If you add magic and do something with the responses, there's more to test.
We need tests.
Currently outside of the repo, I have tests that run on the actual API. I would like to stub out these requests, but I'm not really sure how to go about that, especially considering the fact that the Account_API and Withdraw_API rely on credentials.
Any suggestions welcome.