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

Add TestingRouterStore to ease test setup and DX #282

Open
Phhansen opened this issue Oct 25, 2022 · 2 comments
Open

Add TestingRouterStore to ease test setup and DX #282

Phhansen opened this issue Oct 25, 2022 · 2 comments
Labels
enhancement New feature or request polar This issue accepts pledges (funding) via Polar.sh.

Comments

@Phhansen
Copy link

Phhansen commented Oct 25, 2022

It would be cool with some helpers when testing components and/or services that import RouterStore. Both in relation to provideGlobalRouterStore() vs provideLocalRouterStore() and when setting up the spec with routing in mind as that also depends on RouterTestingModule.

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive 90% of the pledge once the issue is completed & verified
  • Polar receives 10% of the pledge as a fee
Fund with Polar
@LayZeeDK
Copy link
Member

LayZeeDK commented Oct 25, 2022

Thank you for your suggestion, @Phhansen!

We could add a provideTestingRouterStore provider factory that provides a TestingRouterStore service for the RouterStore dependency injection token. But we have to figure out which observable properties we want to stub and whether it makes sense to emit a stubbed value to each observable property individually.

We could also explore and document how RouterTestingModule can be used with any of the actual RouterStore implementations for integrated component tests where we use Router#navigate and Router#navigateByUrl as well as click on routing links. I think this is a possibility.

@LayZeeDK LayZeeDK added the enhancement New feature or request label Oct 25, 2022
@Phhansen
Copy link
Author

I think documenting how RouterTestingModule can be used together with RouterStore is a fairly good idea. they go hand in hand, sort of. I would usually trigger a route change ( ex[routerLink] from a template ) in the test and thus have this trigger the RouterStore observables in return.

That is not to say the other option is not viable at all, it just has more considerations to be made for a proper API that makes sense to all.

@LayZeeDK LayZeeDK added the polar This issue accepts pledges (funding) via Polar.sh. label Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request polar This issue accepts pledges (funding) via Polar.sh.
Projects
None yet
Development

No branches or pull requests

2 participants