how can i create MockActivatedRoute for the parent routes of ActivatedRoute in angular 4 Unit testing
问题 Lets say I have a component that access parent route like this: ngOnInit() { this.sub = this.route.parent.parent.parent.params.subscribe(params => { this.siteId = params["siteId"]; this.loadContents(); this.loadTypes(this.siteId); });} I m providing fake value for parent route like this: providers: [ SiteService, UserService, Modal, Overlay, { provide: ActivatedRoute, useValue: { parent: { parent: { parent: { 'params': Observable.from([{ 'siteId': '156' }]) } } } }, }, OverlayRenderer,