如何覆盖提供MockStore提供的MockBuilder中的选择器值
通常使用 Testbed
TestBed.configureTestingModule({
declarations: [
ABCComponent,
MockComponent(YYYComponent)
],
providers: [
provideMockStore({
initialState: getMockAppState(),
selectors: [
{
selector: getValue,
value: true
}
]
})
]
});
storeStub = TestBed.inject(MockStore);
dispatchSpy = jest.spyOn(storeStub, 'dispatch');
});
```it('.....', () => {
storeStub.overrideSelector(getValue, false)
})