Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MockRouter also map private routes. #820

Merged
merged 6 commits into from
Jul 10, 2020

Conversation

peterp
Copy link
Contributor

@peterp peterp commented Jul 10, 2020

Fix MockRouter not correctly mapping Routes nested in Private.

  • Add test.


const FakePage = () => <></>

describe('MockRouter', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yaaay, tests!

export * from '@redwoodjs/router/dist/index'

export const routes: { [routeName: string]: () => string } = {}

const getPrivateRoutes = (children: React.ReactNode) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you expect any other nested type of routes in the Router in the (near) future? If so it could be worthwhile to make the function recursively look for routes?

If not, ignore me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, we really want to keep it flat, but this might be a great place to adopt the @redwoodjs/structure's implementation instead of duplicating it across Routers.

@peterp peterp merged commit 742bd8c into main Jul 10, 2020
@peterp peterp deleted the pp-make-mock-router-map-private-routes branch July 10, 2020 12:25
@thedavidprice thedavidprice added this to the next release milestone Jul 14, 2020
@renovate renovate bot mentioned this pull request Jun 27, 2022
1 task
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.

None yet

3 participants