Constructor
Optional
ngZone: NgZoneProtected
Readonly
_store$Angular subject store corresponds to store change event and trigger rxjs change event
Mock selectors
Mock substore
Config mock sub-store
Carves off a 'subStore' or 'fractal' store from this one.
The returned object is itself an observable store, however, any selections, dispatches, or invocations of localReducer will be specific to that sub-store and will not know about the parent ObservableStore from which it was created.
Protected
coverageReturns a subject that's connected to any observable returned by the given selector. You can use this subject to pump values into your components or services under test; when they call .select or
in the context of a unit test, MockNgRedux will give them the values you pushed onto your stub.
it('select ticket price data from the substore', async(() => {
const mockSubStore = MockNgRedux.getSubStore(
['WALLABIES', 'items', 'id1']);
const selectorStub = mockSubStore.getSelectorStub('ticketPrice');
selectorStub.next(2);
selectorStub.complete();
animalComponent.ticketPrice$
.subscribe(
ticketPrice => expect(ticketPrice).toEqual(2));
}));
Optional
selector: Selector<S, SelectedState>Optional
comparator: ComparatorReturns a mock substore that allows you to set up selectorStubs for any 'fractal' stores your app creates with NgRedux.configureSubStore.
If your app creates deeply nested sub stores from another sub store, pass the chain of pathSelectors in as ordered arguments to mock the nested sub store out.
it('select name data from the substore', async(() => {
const mockSubStore = MockNgRedux.getSubStore(['WALLABIES', 'items', 'id1']);
const selectorStub = mockSubStore.getSelectorStub('name');
selectorStub.next('Wilbert');
selectorStub.complete();
animalComponent.name$
.subscribe(
name => expect(name).toEqual('Wilbert'));
}));
Rest
...pathSelectors: PathSelector[]Mock provideStore
Accepts a Redux store, then sets it in NgRedux and allows NgRedux to observe and dispatch to it. This should only be called once for the lifetime of your app, for example, in the constructor of your root component.
Mock replaceReducer
Replaces the reducer currently used by the store to calculate the state. You might need this if your app implements code splitting, and you want to load some reducers dynamically. You might also need this if you implement a hot reloading mechanism for Redux.
Mock Select
Select a slice of state to expose as an observable.
Optional
selector: Selector<any, SelectedState>Optional
comparator: ComparatorProtected
setStatic
getReturns a subject that's connected to any observable returned by the given selector. You can use this subject to pump values into your components or services under test; when they call .select or
in the context of a unit test, MockNgRedux will give them the values you pushed onto your stub.
it('select ticket price data from the substore', async(() => {
const mockSubStore = MockNgRedux.getSubStore(
['WALLABIES', 'items', 'id1']);
const selectorStub = mockSubStore.getSelectorStub('ticketPrice');
selectorStub.next(2);
selectorStub.complete();
animalComponent.ticketPrice$
.subscribe(
ticketPrice => expect(ticketPrice).toEqual(2));
}));
Optional
selector: Selector<R, S>Optional
comparator: ComparatorStatic
getReturns a mock substore that allows you to set up selectorStubs for any 'fractal' stores your app creates with NgRedux.configureSubStore.
If your app creates deeply nested sub stores from another sub store, pass the chain of pathSelectors in as ordered arguments to mock the nested sub store out.
it('select name data from the substore', async(() => {
const mockSubStore = MockNgRedux.getSubStore(['WALLABIES', 'items', 'id1']);
const selectorStub = mockSubStore.getSelectorStub('name');
selectorStub.next('Wilbert');
selectorStub.complete();
animalComponent.name$
.subscribe(
name => expect(name).toEqual('Wilbert'));
}));
Rest
...pathSelectors: PathSelector[]Static
resetGenerated using TypeDoc
This is the public of
@angular-redux2/store
. It wraps the global redux store and adds a few other add-on methods. It's what you'll inject into your Angular application as a service.Convenience mock to make it easier to control selector behaviour in unit tests.