-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CoreAPI tests #83
Conversation
Some lint issues, can run |
* master: Use `createIntermediateGroups` in project.yml (kgellci#84) Organise CoreTests into its own folder (kgellci#81) Trim trailing whitespace and newlines HTML
Thats fine. I'd be inclined to ignore On a side note, perhaps it would be prudent to setup Danger to catch things like lint issues? |
Feel free to add a ticket for danger. You can also disable swiftlint rules per file: https://github.com/realm/SwiftLint#disable-rules-in-code |
True, perhaps I’d prefer that to wrapping the code block with disable rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Here are some tests for CoreAPI. This tests the current behaviour, but I'd like to see this expanded in the future, as I'll mention below:
Notes
I had to modify the
getData(forRoute:parameters:completion)
method to accept a mocked session. This doesn't affect the call site, thanks to default values.CoreAPI currently just returns
CoreAPIError.random
if there is no data. I feel this would be better returning the actual error returned by theURLSession.dataTask
.Additionally, there may be some merit in using the status code from the URL response to check its in the 200-299 range.
I modified the
Makefile
to accept an array of test schemes, then look through them to run the tests.