mardi 30 janvier 2018

How to have isolated tests with @ngrx/store

I've been writing a library which is supposed to work both with redux and @ngrx/store, so I am writing integration tests to guarantee that.

I have only one scenario which can be found here.

Having redux tests is very simple since you can just do:

import { createStore, combineReducers } from 'redux';

const store = createStore(
  combineReducers({ reducerName: reducerFunction });
);

store.dispatch({ type: 'Hello World' });

expect(store.getState().greetings)
  .toBe('Hello World');

How can I do the same with ngrx-store? Every resource I found seems to require a full angular environment, including module bootstrapping, components, etc...

Is there any way to have a similar scenario for it?

Aucun commentaire:

Enregistrer un commentaire