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
Improve test stability #276
Conversation
SilentMessageTests were accessing shared client implicitly, now they do explicitly. It's not safe to use non-singleton client. QueryEncodingTests are now deterministic.
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.
Looks good 👍
I wouldn't mind having the change in 3 commits instead of one ;-) :
- Use `sharedClient` in `SilentMessageTests`
- Create `AssertJSONEqual` helper
- Use `AssertJSONEqual` in `QueryEncodingTests `
func AssertJSONEqual(_ expression1: @autoclosure () throws -> Data, | ||
_ expression2: @autoclosure () throws -> Data, |
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.
I wasn't sure about the expressions returning Data
but we will probably create a number of convenient overrides for this as we will use it more. All good 👍
func error(domain: String, code: Int = -1, message: @autoclosure () -> String) -> NSError { | ||
NSError(domain: domain, code: code, userInfo: ["message:": message()]) | ||
} |
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.
I'd suggest making this private so we don't pollute the module namespace.
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.
I'm also using it in QueryEncodingTests
though. Should i move it into its own file?
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.
I see. I think it's OK as is then.
I need one ✅ to be able to merge this :) |
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.
Me: commits
Also me: ✅
In this PR:
RequestRecorderURLProtocol
record only selected requests if needed#no_changelog