@reibo/ngrx-mock-test
v0.0.8
Published
[![npm](https://img.shields.io/npm/v/%40reibo%2Fngrx-mock-test.svg?style=flat-square)](https://www.npmjs.com/package/%40reibo%2Fngrx-mock-test) ![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg) [![npm](https://img.shields.io/npm/dt/%4
Downloads
56
Readme
@reibo/ngrx-mock-test
A library that implements the features described on
Use this library
full example on stackblitz or in the src folder
Install the npm dependency
npm i @reibo/ngrx-mock-test -d
, or if you preffer yarn yarn add @reibo/ngrx-mock-test -d
Initialize the Mock store in your project
The purpose of this mock store is to use it on feature based stores.
You will provide the data in the store like you decide, so it is ideal to test with mocked data.
In the MockStoreModule in your Testbed imports with your feature name and an initial state.
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [ MockStoreModule.forRoot('feature_name', initialState)],
...
}).compileComponents();
}));
Next get store out of the testbed
store = TestBed.get(Store);
Change the state in your test during testing with the mock
store.dispatch(new MockAction({ name: "foo" }));
Do you like to work with streams and you us marble testing?
Try out:
const inputStream = m.hot('-a-b-a', stream);
store.dispatch(new MockStream(inputStream));