Skip to content

test(react-router): check the route context at beforeLoad, loader, and component - #1708

Merged
SeanCassiere merged 6 commits into
mainfrom
test/routeContext
Jun 5, 2024
Merged

SeanCassiere merged 6 commits into
mainfrom
test/routeContext

Conversation

@SeanCassiere

@SeanCassiere SeanCassiere commented Jun 5, 2024 •

Copy link
Copy Markdown
Member

This is just the start to making sure that route context is correctly tested.

Route context should be checked at 3 distinct points:

  • In the beforeLoad callback function.
  • In the loader callback function.
  • In the component rendered on the screen.

The idea here is that each scenario context scenario we come up with should be checked at all three points to make sure the route context experience is consistent at all levels.

Currently, these tests check for the following:

  • Context available at the root route.
  • Context available at the index route.
  • Context modified at the root route, is correctly available at the index route.

This can be used as a base for building the tests to fix the context issues we are currently facing.

@nx-cloud

nx-cloud Bot commented Jun 5, 2024 •

Copy link
Copy Markdown
Contributor

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 94a0599. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 4 targets

Sent with 💌 from NxCloud.

@SeanCassiere
SeanCassiere marked this pull request as ready for review June 5, 2024 13:33
@SeanCassiere SeanCassiere changed the title test(react-router): add tests to check the context at beforeLoad, loader, and the component test(react-router): check the route context at beforeLoad, loader, and component Jun 5, 2024
@SeanCassiere
SeanCassiere merged commit 07a6fde into main Jun 5, 2024
@SeanCassiere
SeanCassiere deleted the test/routeContext branch June 5, 2024 13:34
@SeanCassiere

Copy link
Copy Markdown
Member Author

These changes should be a good base for building the tests and eventual fixes for #1650, #1656, and #1670.

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