Skip to content

test(solid-start): add missing custom-basepath tests - #5641

Merged
birkskyum merged 1 commit into
mainfrom
test(solid-start)--add-missing-custom-basepath-tests
Oct 26, 2025
Merged

test(solid-start): add missing custom-basepath tests#5641
birkskyum merged 1 commit into
mainfrom
test(solid-start)--add-missing-custom-basepath-tests

Conversation

@birkskyum

@birkskyumbirkskyum commented Oct 26, 2025

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added logout page with form-based user sign-out capability
    • Added new redirect routes for testing client-side and server-side navigation flows
    • Server function URLs now correctly include app basepath configuration for custom deployments
  • Tests

    • Added end-to-end tests validating logout functionality, client-side redirects, and server-side redirect handling
  • Chores

    • Removed unused imports from the posts detail page

@coderabbitai

coderabbitaiBot commented Oct 26, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The PR adds three new routes to a SolidStart e2e test application with custom basepath configuration: a logout route demonstrating server function URL handling, and two redirect routes showcasing client-side and server-side redirect patterns. The generated route tree and integration tests are updated accordingly.

Changes

Cohort / File(s)Summary
New route implementations
e2e/solid-start/custom-basepath/src/routes/logout.tsx, e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx, e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx
Three new routes added: logout page with server function POST to '/', redirect index with link to /redirect/throw-it, and redirect throw-it route that throws redirect to /posts/1 in beforeLoad hook
Generated route tree
e2e/solid-start/custom-basepath/src/routeTree.gen.ts
Route tree extended with LogoutRoute, RedirectIndexRoute, and RedirectThrowItRoute constants; FileRoutesByFullPath, FileRoutesByTo, FileRoutesById, and type declarations updated to include new routes
Route import cleanup
e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx
Removed unused ErrorComponent and ErrorComponentProps imports; added data-testid="post-view" attribute to root div
E2E tests
e2e/solid-start/custom-basepath/tests/navigation.spec.ts
Three new test cases added: server function URLs with basepath, client-side redirect flow, and server-side redirect with Location header validation

Sequence Diagram(s)

sequenceDiagram
participant User
participant Browser
participant App
participant Server
rect rgb(200, 220, 240)
note over User,Server: Logout - Server Function Flow
User->>Browser: Navigate to /logout
Browser->>App: Load logout page
App->>User: Render form with server action
User->>Browser: Submit form
Browser->>Server: POST to /custom/basepath/_serverFn/...
Server->>Server: Execute logoutFn
Server->>Browser: Redirect to /
Browser->>App: Navigate to /
end
rect rgb(220, 240, 200)
note over User,Browser: Client-Side Redirect
User->>Browser: Navigate to /redirect
Browser->>App: Load redirect index
App->>User: Render link to /redirect/throw-it
User->>Browser: Click link
Browser->>App: Navigate to /redirect/throw-it
end
rect rgb(240, 220, 200)
note over Browser,App: Server-Side Redirect (beforeLoad)
Browser->>App: Load /redirect/throw-it
App->>App: Execute beforeLoad hook
App->>App: Throw redirect({ to: '/posts/1' })
App->>Browser: Redirect to /posts/1
Browser->>App: Navigate to /posts/1
App->>User: Render post view
end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

  • Route implementations follow consistent, straightforward patterns with no complex logic
  • Auto-generated routeTree.gen.ts does not require detailed review
  • Import removal in posts.$postId.tsx is trivial
  • Test cases follow similar structure with clear assertions; verify test logic aligns with route implementations

Possibly related PRs

Suggested labels

package: solid-router

Suggested reviewers

  • schiller-manuel
  • brenelz

Poem

🐰 Three hops down the routing trail,
Where logout forms and redirects sail!
Basepath breadcrumbs lead the way,
Through throw-its and links, hip-hop hooray! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title Check✅ PassedThe pull request title "test(solid-start): add missing custom-basepath tests" accurately describes the primary purpose of the changeset. The PR adds three new end-to-end tests to the navigation.spec.ts file that verify custom basepath functionality, including server function URLs, client-side redirects, and server-side redirects. While the changeset also includes supporting route implementations (logout.tsx, redirect.index.tsx, redirect.throw-it.tsx) and route tree updates, these are standard infrastructure required for e2e tests and the title appropriately emphasizes the testing focus. The conventional commit prefix "test(" clearly signals this is a testing change, and "custom-basepath" specifically conveys what is being tested.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test(solid-start)--add-missing-custom-basepath-tests

📜 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 3b091d0 and 4fc0f84.

📒 Files selected for processing (6)
  • e2e/solid-start/custom-basepath/src/routeTree.gen.ts (12 hunks)
  • e2e/solid-start/custom-basepath/src/routes/logout.tsx (1 hunks)
  • e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx (2 hunks)
  • e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx (1 hunks)
  • e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx (1 hunks)
  • e2e/solid-start/custom-basepath/tests/navigation.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx
  • e2e/solid-start/custom-basepath/src/routes/logout.tsx
  • e2e/solid-start/custom-basepath/tests/navigation.spec.ts
  • e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx
  • e2e/solid-start/custom-basepath/src/routeTree.gen.ts
  • e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx
**/src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

Place file-based routes under src/routes/ directories

Files:

  • e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx
  • e2e/solid-start/custom-basepath/src/routes/logout.tsx
  • e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx
  • e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx
e2e/**

📄 CodeRabbit inference engine (AGENTS.md)

Store end-to-end tests under the e2e/ directory

Files:

  • e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx
  • e2e/solid-start/custom-basepath/src/routes/logout.tsx
  • e2e/solid-start/custom-basepath/tests/navigation.spec.ts
  • e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx
  • e2e/solid-start/custom-basepath/src/routeTree.gen.ts
  • e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx
🧬 Code graph analysis (4)
e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx (1)
e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx (1)
  • Route (7-14)
e2e/solid-start/custom-basepath/src/routes/logout.tsx (3)
e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx (1)
  • Route (7-14)
e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx (1)
  • Route (3-5)
e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx (1)
  • Route (3-10)
e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx (2)
e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx (1)
  • Route (7-14)
e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx (1)
  • Route (3-10)
e2e/solid-start/custom-basepath/src/routeTree.gen.ts (1)
e2e/react-start/custom-basepath/src/routeTree.gen.ts (1)
  • FileRoutesByTo (114-127)
🔇 Additional comments (10)
e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx (1)

1-15: LGTM! Clean redirect parent route implementation.

The route correctly defines a parent page for redirect testing with appropriate Link navigation and test identifiers for e2e validation.

e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx (1)

1-10: LGTM! Proper redirect pattern for server-side redirect testing.

The beforeLoad hook correctly throws a redirect to demonstrate server-side redirect behavior with basepath handling. This pattern aligns with TanStack Router's redirect API.

e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx (2)

1-1: LGTM! Import cleanup is correct.

The removal of unused ErrorComponent and ErrorComponentProps imports is appropriate, while PostErrorComponent remains correctly imported and used.


20-20: LGTM! Test identifier added for e2e validation.

The data-testid="post-view" attribute enables the e2e tests to verify redirect behavior and post visibility.

e2e/solid-start/custom-basepath/src/routes/logout.tsx (2)

4-11: LGTM! Server function correctly configured for basepath testing.

The server function with POST method and redirect handler demonstrates the expected pattern for testing basepath-aware server function URL generation.


17-32: LGTM! Form effectively demonstrates basepath-aware server function URLs.

The form's use of logoutFn.url as the action attribute is exactly what's needed to verify that server function URLs correctly include the application's basepath. The explanatory comments make the test intent clear.

e2e/solid-start/custom-basepath/tests/navigation.spec.ts (3)

36-45: LGTM! Server function basepath validation is correct.

The test properly verifies that server function URLs include the application's basepath by checking that the form action starts with /custom/basepath/_serverFn/.


47-54: LGTM! Client-side redirect test is well-structured.

The test correctly validates client-side navigation to the redirect route, followed by the redirect to the post view, ensuring both the UI renders and the URL includes the proper basepath.


56-70: LGTM! Comprehensive server-side redirect validation.

The test thoroughly validates server-side redirect behavior by:

  1. Verifying the redirect completes and renders the correct view
  2. Checking that the Location header in the redirect response includes the proper basepath

The use of maxRedirects: 0 correctly prevents following the redirect, enabling inspection of the raw redirect response.

e2e/solid-start/custom-basepath/src/routeTree.gen.ts (1)

1-367: Auto-generated route tree is correctly updated.

The route tree properly registers the three new routes (/logout, /redirect, /redirect/throw-it) across all type mappings and augmentations. As an auto-generated file, this will be maintained by the TanStack Router code generator.


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 and usage tips.

@nx-cloud

nx-cloudBot commented Oct 26, 2025

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 4fc0f84

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded1m 5sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded2sView ↗

☁️ Nx Cloud last updated this comment at 2025-10-26 22:15:24 UTC

@pkg-pr-new

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5641

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5641

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5641

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5641

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5641

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5641

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5641

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5641

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5641

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5641

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5641

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5641

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5641

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5641

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5641

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5641

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5641

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5641

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5641

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5641

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5641

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5641

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5641

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@5641

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5641

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5641

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5641

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5641

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5641

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5641

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5641

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5641

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5641

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5641

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5641

commit: 4fc0f84

@birkskyum
birkskyum merged commit 3a0cfa9 into mainOct 26, 2025
6 checks passed
@birkskyum
birkskyum deleted the test(solid-start)--add-missing-custom-basepath-tests branch October 26, 2025 22:37
@birkskyumbirkskyum added this to the catch up solid to react milestone Oct 26, 2025
Sign up for freeto 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

@birkskyum