Add tests for behavior no test guarded - #94
Merged
Merged
Conversation
The suite sat at 100% coverage while several documented behaviors had nothing pinning them: every assignment that writes a validated value back into the parsed map could be deleted, `between` could accept an array of any length, `sort[name]=DESC` could reach the builder uncanonicalized, and the querier override hooks, `filterDefaults`, `sortDefaults`, `pageDefaults`, and `defineValidation` were only ever tested for their defaults. Each addition here was written against a mutation that survived the old suite and fails against the new one. The filter parser's comment claimed `Date` values are treated as filter values. They aren't: the Joi `object()` alternative shallow-copies a Date into a husk with no own keys, so it takes the operator-object branch and the filter silently disappears. The comment now claims only the arrays and `null` behavior that the check actually delivers. Also drops the `Date` claim's cousin in coverage terms: an empty string for `filter[x][is]` is rejected by the parser before the adapter's `.empty(['null', ''])` can turn it into null, so only the `null` string is covered here. That looks like a real defect rather than a test gap, so it's left alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The suite sat at 100% coverage while several documented behaviors had nothing
pinning them. Every assignment that writes a validated value back into the
parsed map could be deleted with the suite still green;
betweenwould acceptan array of any length;
sort[name]=DESCcould reach the builderuncanonicalized; and the querier override hooks,
filterDefaults,sortDefaults,pageDefaults, anddefineValidationwere each tested onlyfor being undefined by default. Every addition here was written against a
mutation that survived the old suite and fails against the new one, so each
test is known to hold something in place.
The filter parser's comment claimed
Datevalues are treated as filtervalues. They aren't: the Joi
object()alternative shallow-copies a Date intoa husk with no own keys, so it takes the operator-object branch and the filter
silently disappears. The comment now claims only the arrays and
nullbehavior the check actually delivers.
One thing found along the way and deliberately left alone: an empty string for
filter[x][is]is rejected by the parser ("is not allowed to be empty")before the adapter's
.empty(['null', ''])can turn it into null, so the''half of that rule is unreachable end-to-end.
?filter[x][is]=is a naturalway to ask for
is nulland currently errors. That reads as a defect ratherthan a test gap, so these tests cover the
'null'string only and I'd ratherfix it separately than bury a behavior change in a test PR.
🤖 Generated with Claude Code