Reputation: 33
NGRX Store dispatch issue is not working in my code. Getting below error. So, How to resolve this issue.
TypeError: Cannot read properties of undefined (reading 'dispatch')
app.component.spect.ts:
it('should dispatch action and handle success response', () => {
const actionInfo: INgrxActionInfo =
vasActionInfo[VasActionEnum.DELETE_DATA] as INgrxActionInfo;
const payload = {
inputData: {
name: data.name,
place: data.place,
},
};
const dispatchSpyon = spyOn(store, 'dispatch').and.callThrough();
expect(dispatchSpyon).toHaveBeenCalledWith(vasNgrxAction.action(actionInfo, true, payload));
});
Upvotes: 0
Views: 16