Skip to content

feat: withRouteTree helper for testing full path routing behaviors#15

Merged
bdow merged 3 commits into
mainfrom
with-route-tree
Jun 8, 2026
Merged

feat: withRouteTree helper for testing full path routing behaviors#15
bdow merged 3 commits into
mainfrom
with-route-tree

Conversation

@bdow

@bdow bdow commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@bdow bdow force-pushed the with-route-tree branch 4 times, most recently from c5a6827 to b7ef305 Compare June 8, 2026 17:10
Comment thread src/index.test.tsx
Comment thread tsconfig.test.json Outdated
Comment thread tsconfig.json Outdated
Update to use rtl-utils library for testing. Required setting up fake timers.
@bdow bdow force-pushed the with-route-tree branch from b7ef305 to 472876c Compare June 8, 2026 17:29
Comment thread tsconfig.json
"src": ["src"]
}
},
"exclude": ["node_modules", "src/**/*.test.tsx", "src/setupTests.ts"]

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.

Since tsconfig.test.json went away, we probably don't want the last two excluded anymore?

@bdow bdow Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If I exclude them, then i get:

Could not find a declaration file for module '@homebound/rtl-utils'. '/Users/bdow/workspace/rtl-react-router-utils/node_modules/@homebound/rtl-utils/build/lib/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/homebound__rtl-utils` if it exists or add a new declaration (.d.ts) file containing `declare module '@homebound/rtl-utils';`ts(7016)

Comment thread readme.md Outdated
Comment thread src/index.tsx
Comment thread src/index.tsx Outdated
*
* Does not inject QueryParamProvider; route-tree shells (e.g. AppShell) provide that.
*/
export function withRouteTree(routes: RouteObject[], url: string = "/"): MemoryRouterHelper {

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.

Another naive question, but maybe just withRoutes?

The "...Tree" made me wonder "...what's a route tree?" when really it's "just an array of RouteObject[]s" (afaiu! 😅 )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, that's fine. The tree is because of how the paths do traverse down a tree like structure.

@bdow bdow merged commit 7b39221 into main Jun 8, 2026
2 checks passed
@bdow bdow deleted the with-route-tree branch June 8, 2026 17:54
@homebound-team-bot

Copy link
Copy Markdown

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants