Starting out with angular 2 after spending time with angular 1. Not having unit tested this much as it\'s more of a side project thing, I\'m trying at least start out OK...
For testing, you should use the RouterTestingModule instead of the RouterModule
. If you want to add routes you can use withRoutes
imports: [
RouterTestingModule.withRoutes(Routes) // same any normal route config
]
See Also
ActivatedRoute
. Sometimes you don't want the whole routing facility when unit testing. You can just mock the route.