vendredi 6 novembre 2020

addReducer missing on MockStore

In our NGRX setup we use ReducerManager.addReducer and ReducerManager.removeReducer.

When writing unit / integration tests, we would need to mock the store, but there is no way to addReducer on the MockStore class (source: https://github.com/ngrx/platform/blob/master/modules/store/testing/src/mock_store.ts#L116)

At the moment tests are failing because of the error this.reducerManager.addReducers is not a function where this.reducerManager is the DI-ed MockReducerManager.

Also, worth mentioning that I would not like to mix imports of modules StoreModule.forRoot({...}) and provideMockStore({...}), but only use provideMockStore({...}).

What is the proposed way of testing code that uses ReducerManager.addReducer and/or ReducerManager.removeReducer?

Aucun commentaire:

Enregistrer un commentaire