AshKeys

Confessions and Confusions of Ashok M A. Personal and Professional Blog.

Ashok Mannolu Arunachalam, NgRxAnguarNodeJSFix
Back

Fix: No provider for MockStore in NgRx

We have recently started using NgRx in our project and it is awesome ^_^. We achieved a lot of performance benefits just by making use of the shared state store.

It is just amazing how it keeps the state true across the Single Page Application (SPA). It gave us the power to keep one single source of truth.

No provider for MockStore

As part of the development, I was writing unit tests for a component that uses the Store<AppState> as a dependency. Naturally, I followed the docs for the unit testing and injected a MockStore as well.

Then, when I ran it I was keep getting the No Provider for MockStore error. After a long search for answers, I realized that this problem persists with me using 7.x.x version of @ngrx and upgraded to the latest which was 9.1.0 .

To me, upgrading to the latest @ngrx solved the problem.