mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 03:23:07 +00:00
24 lines
498 B
TypeScript
24 lines
498 B
TypeScript
import { Action } from '@ngrx/store';
|
|
import { Observable } from 'rxjs/Observable';
|
|
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
|
|
|
export class MockStore<T> extends BehaviorSubject<T> {
|
|
|
|
constructor(private _initialState: T) {
|
|
super(_initialState);
|
|
}
|
|
|
|
dispatch = (action: Action): void => {
|
|
console.info();
|
|
}
|
|
|
|
select = <R>(pathOrMapFn: any): Observable<T> => {
|
|
return Observable.of(this.getValue());
|
|
}
|
|
|
|
nextState(_newState: T) {
|
|
this.next(_newState);
|
|
}
|
|
|
|
}
|