testing-library / testing-library/angular-testing-library
Interop with RouterTestingHarness
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 792
- Forks
- 95
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 3
Description
Angular introduced RouterTestingHarness as a utility for testing a component that depends on the router.
RouterTestingHarness manages a root component to instantiate <router-outlet> and returns routed component by navigateByUrl(url, component) method. AFAIK, there is a conflict with the testing-library's render() approach. The responsibility for instantiating a ComponentFixture must be one or the other.
So, I can't suggest a specific solution yet, but I think that testing involving Router can be complex and this is precisely the kind of area that the Testing Library should help with. It would be desirable to provide a means to escape from MockRouter and MockActivatedRoute while still being able to use them with the Testing Library.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Angular's RouterTestingHarness documentation and the testing-library render() approach, then compare their ComponentFixture responsibilities. Examine how MockRouter and MockActivatedRoute are used in router tests. Done means the issue has a decided design for interoperating with RouterTestingHarness while retaining appropriate testing-library support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100