Skip to content

Add tests for behavior no test guarded - #94

Merged
jstayton merged 1 commit into
developmentfrom
add-missing-test-coverage
Aug 27, 2026
Merged

jstayton merged 1 commit into
developmentfrom
add-missing-test-coverage

Conversation

@jstayton

Copy link
Copy Markdown
Contributor

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; between would 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 each tested only
for 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 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 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 natural
way to ask for is null and currently errors. That reads as a defect rather
than a test gap, so these tests cover the 'null' string only and I'd rather
fix it separately than bury a behavior change in a test PR.

🤖 Generated with Claude Code

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>
@jstayton
jstayton merged commit f8da5b5 into development Aug 27, 2026
4 checks passed
@jstayton
jstayton deleted the add-missing-test-coverage branch August 27, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant