How to mock an activatedRoute parent Route in angular2 for testing purposes? How to mock an activatedRoute parent Route in angular2 for testing purposes? typescript typescript

How to mock an activatedRoute parent Route in angular2 for testing purposes?


Using TestBed

 beforeEach(async(() => {    TestBed.configureTestingModule({      declarations: [YourComponent],      imports: [],      providers: [        {          provide: ActivatedRoute, useValue: {            params: Observable.of({ id: 'test' })          }        }      ]    })      .compileComponents();  }));