Created
March 19, 2018 05:20
-
-
Save phillipzada/30fe896c85a898ed277f6939339b4d51 to your computer and use it in GitHub Desktop.
Mock Store
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Action } from '@ngrx/store'; | |
import { Observable } from 'rxjs/Observable'; | |
import { Subject } from 'rxjs/Subject'; | |
import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | |
import { map } from 'rxjs/operator/map'; | |
export class MockStore<T> extends BehaviorSubject<T> { | |
constructor(private _initialState: T) { | |
super(_initialState); | |
} | |
dispatch = (action: Action): void => { | |
} | |
select = (pathOrMapFn: any, ...paths: string[]): Observable<any> => { | |
return map.call(this, pathOrMapFn); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment