Skip to content

feat(common): add provideLocationMocks() function to provide Location mocks#47674

Closed
AndrewKushnir wants to merge 1 commit intoangular:mainfrom
AndrewKushnir:location_mocks
Closed

feat(common): add provideLocationMocks() function to provide Location mocks#47674
AndrewKushnir wants to merge 1 commit intoangular:mainfrom
AndrewKushnir:location_mocks

Conversation

@AndrewKushnir
Copy link
Contributor

This commit adds the provideLocationMocks() function that returns mocks for the Location and LocationStrategy classes. This function can be used in tests to configure an environment where it's possible to fire simulated location events (helpful when testing Router configuration).

PR Type

What kind of change does this PR introduce?

  • Feature

Does this PR introduce a breaking change?

  • Yes
  • No

@AndrewKushnir AndrewKushnir added feature Label used to distinguish feature request from other issues state: WIP area: common Issues related to APIs in the @angular/common package target: major This PR is targeted for the next major release labels Oct 5, 2022
@ngbot ngbot bot modified the milestone: Backlog Oct 5, 2022
Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

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

We can remove this now as well: https://github.com/angular/angular/blob/main/packages/router/testing/src/provide_router_for_testing.ts

And then all references to that will have to do provideRouter(...), provideLocationMocks()

…on mocks

This commit adds the `provideLocationMocks()` function that returns mocks for the `Location` and `LocationStrategy` classes. This function can be used in tests to configure an environment where it's possible to fire simulated location events (helpful when testing Router configuration).
@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: WIP labels Oct 8, 2022
@AndrewKushnir AndrewKushnir requested a review from alxhub October 8, 2022 18:29
@AndrewKushnir AndrewKushnir marked this pull request as ready for review October 8, 2022 18:29
@AndrewKushnir
Copy link
Contributor Author

@atscott thanks for the feedback, I've updated the PR to remove the provideRouterForTesting and use the new function instead.

@alxhub could you please review this PR when you get a chance (the PR is needed before v15 feature freeze).

Copy link
Contributor

@dylhunn dylhunn left a comment

Choose a reason for hiding this comment

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

reviewed-for: public-api

@pullapprove pullapprove bot requested a review from jessicajaniuk October 10, 2022 16:54
@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 10, 2022
@AndrewKushnir
Copy link
Contributor Author

Merge-assistance (cc @jessicajaniuk): this PR is ready for merge, but needs one more public-api approval. Could you please take a look when you get a chance? Thank you.

Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

reviewed-for: public-api

@jessicajaniuk jessicajaniuk removed the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Oct 10, 2022
@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit c0c7efa.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: common Issues related to APIs in the @angular/common package feature Label used to distinguish feature request from other issues target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants