Skip to content

test: cover query parameter coercion - #22

Merged
omermecitoglu merged 1 commit into
omermecitoglu:mainfrom
kriptoburak:codex/xquik-search-query-test
Aug 13, 2026
Merged

test: cover query parameter coercion#22
omermecitoglu merged 1 commit into
omermecitoglu:mainfrom
kriptoburak:codex/xquik-search-query-test

Conversation

@kriptoburak

@kriptoburak kriptoburak commented Jul 2, 2026

Copy link
Copy Markdown

Summary

  • Cover string, enum, and coerced-number query parameters with a repository-native fixture.
  • Verify validated values reach the GET route action.
  • Remove vendor-specific names and data from the regression test.

Validation

  • npx vitest run src/core/definer.test.ts (14 tests passed)
  • npm run lint
  • git diff --check

Summary by CodeRabbit

  • Tests
    • Added coverage verifying that GET query parameters are validated against schemas, including enum checks and numeric conversion.
    • Confirmed validated query data is passed to route actions with empty path and body parameters.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@kriptoburak, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f0e596c-06cf-4193-8fb1-88eee757a0eb

📥 Commits

Reviewing files that changed from the base of the PR and between 4b5e168 and 7c72018.

📒 Files selected for processing (1)
  • src/core/definer.test.ts
📝 Walkthrough

Walkthrough

The test suite adds coverage for GET query parameters parsed through a Zod schema. It verifies enum validation, numeric coercion, and route action arguments with pathParams and body set to null.

Changes

GET query validation

Layer / File(s) Summary
GET query parameter test
src/core/definer.test.ts
Adds a test that validates enum query values, coerces limit to an integer, and passes parsed parameters to the route action.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: 🟡 Moderate · up to 4b5e1

The new test omits required route metadata, so it may fail type-checking and is not merge-ready until that metadata is added.

Possibly related PRs

Suggested reviewers: sqikerz

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the added test for query parameter coercion.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@omermecitoglu

Copy link
Copy Markdown
Owner

Could you rename the test and drop the "Xquik"/Twitter-specific fixture data (operationId, tags, description, URL)? Test names that describe the actual behavior being verified make it much easier for future readers to know why a test exists at a glance. Something like:

it("should coerce and validate query parameters via Zod schema (string, enum, coerced number)", () => {
  // ...
});

@kriptoburak
kriptoburak force-pushed the codex/xquik-search-query-test branch from cb701a2 to 4b5e168 Compare August 13, 2026 03:47
@kriptoburak kriptoburak changed the title test: cover Xquik search query handling test: cover query parameter coercion Aug 13, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/core/definer.test.ts (1)

47-51: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add rejection-path coverage for the query schema.

The test uses valid values for every field. It proves limit coercion, but it cannot detect regressions in query.min(1), the sort enum, or the limit bounds. Add invalid requests and assert a 400 response and no action invocation for each rejected request.

Also applies to: 61-81

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/definer.test.ts` around lines 47 - 51, Add rejection-path tests
around the query schema and request handler, covering an empty query, an
unsupported sort value, and limits below 1 and above 100. For each invalid
request, assert a 400 response and verify the action is not invoked, while
preserving the existing valid coercion coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/definer.test.ts`:
- Around line 52-60: Add generic summary, description, and tags metadata to the
defineRoute call for listItems in the test, satisfying RouteOptions without
reintroducing provider-specific fixture values.

---

Nitpick comments:
In `@src/core/definer.test.ts`:
- Around line 47-51: Add rejection-path tests around the query schema and
request handler, covering an empty query, an unsupported sort value, and limits
below 1 and above 100. For each invalid request, assert a 400 response and
verify the action is not invoked, while preserving the existing valid coercion
coverage.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cdbd10c-b2d8-4c35-bdeb-ab48480d7297

📥 Commits

Reviewing files that changed from the base of the PR and between 0d92a83 and 4b5e168.

📒 Files selected for processing (1)
  • src/core/definer.test.ts

Comment thread src/core/definer.test.ts
@kriptoburak
kriptoburak force-pushed the codex/xquik-search-query-test branch from 4b5e168 to 7c72018 Compare August 13, 2026 03:59
@omermecitoglu
omermecitoglu merged commit e956f78 into omermecitoglu:main Aug 13, 2026
1 check passed
@omermecitoglu

Copy link
Copy Markdown
Owner

thanks for your contribution 🙏

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.

2 participants