Tutorial by Topics: ngrx



@ngrx/Store is becoming more widely used in Angular 2 projects. As such, the Store is required to be injected into the constructor of any Component or Service that wishes to use it. Unit testing Store isn't as easy as testing a simple service though. As with many problems, there are a myriad of ways to implement solutions. However, the basic recipe is to write a mock class for the Observer interface and to write a mock class for Store. Then you can inject Store as a provider in your TestBed.
Ngrx is a powerful library that you can use with Angular2. The idea behind is to merge two concepts that plays well together to have a reactive app with a predictable state container : - [Redux][1] - [RxJs][2] The main advantages : - Sharing data in your app between your components is going to easier - Testing your app core logic consists to test pure functions, without any dependency on Angular2 (very easy so !) [1]: http://redux.js.org [2]: http://reactivex.io/rxjs

Page 1 of 1