So i've looked at many issues online including this one https://github.com/angular/quickstart/issues/320 and i'm stumped...
How I have my code set up is that I have my main describe create my testbed component, Here I have my mockParams set up for the active route so we can this.route.queryparams.subscribe(..), My problem is I am unable to overwrite the values in a different describe or 'it' block.
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MyComponent],
imports: [RouterTestingModule
})],
providers: [
{ provide: ActivatedRoute, useValue: mockParams },
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
Here is an example of me adding a the override in a different NESTED describe block...
beforeEach(() => {
TestBed.overrideProvider(ActivatedRoute,
{useValue: newMockParams});
TestBed.compileComponents();
fixture = TestBed.createComponent(MyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
It's almost like this doesnt run at all... the new mock params do not change if i re-use mockParams and change the values then it will change the value in the original describe, Do I really have to re-create my component in every nested describe? It just doesn't feel right that I would have to do so when the only thing I need to change is the provider, i'm unsure what overrideProvider even does at this point! Any help would be greatly appreciated!