0.0.8 • Published 5 years ago

@reibo/ngrx-mock-test v0.0.8

Weekly downloads
193
License
-
Repository
github
Last release
5 years ago

@reibo/ngrx-mock-test

npm GitHub npm

CircleCI

styled with prettier

A library that implements the features described on

Blog on medium

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));
0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago