Skip to content

test(client): codec base url#327

Merged
dinwwwh merged 1 commit intomainfrom
test/client/base-url
Apr 3, 2025
Merged

test(client): codec base url#327
dinwwwh merged 1 commit intomainfrom
test/client/base-url

Conversation

@dinwwwh
Copy link
Copy Markdown
Member

@dinwwwh dinwwwh commented Apr 3, 2025

Summary by CodeRabbit

  • Tests
    • Expanded test coverage to ensure API request URLs are constructed consistently across different base URL formats, including variations with trailing slashes and embedded query parameters.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orpc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2025 8:32am

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2025

Walkthrough

The pull request adds new test cases to verify proper base URL handling in two codec modules: one for RPC and another for OpenAPI. Each test suite assesses URL concatenation behavior when provided with various base URL formats (with or without trailing slashes and with preset query parameters). These changes are confined to test files and do not alter any public API declarations.

Changes

Files Summary
packages/client/.../rpc-link-codec.test.ts
packages/openapi-client/.../openapi-link-codec.test.ts
Introduced test suites validating base URL encoding for RPC and OpenAPI codecs, ensuring correct path appending and query parameter retention across different formats.

Possibly related PRs

  • unnoq/orpc#324: Enhances tests for the StandardRPCLinkCodec by extending its base URL handling.
  • unnoq/orpc#266: Modifies the StandardRPCLinkCodec to handle the last-event-id header, complementing the URL encoding improvements.

Poem

In the code garden, I hop with glee,
New tests bloom like carrots for me.
URL paths align in a joyful dance,
With every slash and query given a chance.
Hopping through tests, my heart sings free—
A bunny’s cheer for code perfected is key!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4038fb9 and 40de9cd.

📒 Files selected for processing (2)
  • packages/client/src/adapters/standard/rpc-link-codec.test.ts (1 hunks)
  • packages/openapi-client/src/adapters/standard/openapi-link-codec.test.ts (1 hunks)
🧰 Additional context used
🧬 Code Definitions (2)
packages/client/src/adapters/standard/rpc-link-codec.test.ts (1)
packages/client/src/adapters/standard/rpc-link-codec.ts (1)
  • StandardRPCLinkCodec (59-159)
packages/openapi-client/src/adapters/standard/openapi-link-codec.test.ts (1)
packages/openapi-client/src/adapters/standard/openapi-link-codec.ts (1)
  • StandardOpenapiLinkCodec (31-244)
🔇 Additional comments (2)
packages/client/src/adapters/standard/rpc-link-codec.test.ts (1)

107-140: Well-structured tests for base URL handling!

These tests thoroughly verify the StandardRPCLinkCodec's behavior with different base URL formats:

  1. With a path prefix (no trailing slash)
  2. With a path prefix ending with a trailing slash
  3. With a path prefix and existing query parameters

This is good coverage for ensuring the URL is constructed correctly in all scenarios, especially verifying that trailing slashes are handled properly and query parameters are preserved.

packages/openapi-client/src/adapters/standard/openapi-link-codec.test.ts (1)

270-300: Good test coverage for OpenAPI codec base URL handling!

These tests match the pattern established in the RPC codec tests, ensuring consistent behavior across both implementations. The tests verify:

  1. Base URL with path prefix
  2. Base URL with trailing slash
  3. Base URL with existing query parameters

Each test correctly verifies that the URL is constructed as expected, with proper handling of trailing slashes and preservation of query parameters.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 3, 2025

More templates

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@327

@orpc/client

npm i https://pkg.pr.new/@orpc/client@327

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@327

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@327

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@327

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@327

@orpc/react

npm i https://pkg.pr.new/@orpc/react@327

@orpc/server

npm i https://pkg.pr.new/@orpc/server@327

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@327

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@327

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@327

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@327

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@327

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@327

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@327

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@327

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@327

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@327

commit: 40de9cd

@dinwwwh dinwwwh merged commit c40d0c9 into main Apr 3, 2025
8 checks passed
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