Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the IP tests, there were functions making functions making objects making assertions.
It was difficult to wrap my head around what was going on.
Functions have some benefits but also makes it hard to keep track of what’s going on, creating arguably potentially smelly code.
The alternative is to be a bit more verbose in each test case. Less functions to build things. Loops and arrays for repetition.
I did that.
Some examples of arguable smells were:
make
is not used in these)platform
option deals with which headers are supported but theproxy
option which IP is supported, but then the question is, what option takes precedence at what abstraction? What is really tested?That being said, I importantly did not change the tests. Didn’t add, move, or remove. But there is room for that.
I do wonder whether we really need to test every potential valid/invalid IP (64 tests) at every header or other property in the request.
More important seems a split around platforms, to test that most headers are not supported if a platform is set. Which is documented in the code but currently not tested.
Still, for the same number of lines, I do think it’s now more obvious what is going on.
I left the commits so work progress can be seen, but that shows a lot of the in-between-state, I’d recommend side by side.