Permalink
Browse files

feat(ActionsObservable.of): Added support for ActionsObservable.of(..…

….actions) as shorthand, mostly useful for testing Epics

Closes #98
  • Loading branch information...
jayphelps committed Sep 11, 2016
1 parent b595a56 commit 25f50d0107f13f88cba43859d590a64c872c644b
Showing with 14 additions and 0 deletions.
  1. +5 −0 src/ActionsObservable.js
  2. +9 −0 test/ActionsObservable-spec.js
@@ -1,7 +1,12 @@
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { filter } from 'rxjs/operator/filter';

export class ActionsObservable extends Observable {
static of(...actions) {
return new this(of(...actions));
}

constructor(actionsSubject) {
super();
this.source = actionsSubject;
@@ -10,6 +10,15 @@ describe('ActionsObservable', () => {
expect(ActionsObservable).to.be.a('function');
});

it('should support ActionsObservable.of(...actions)', () => {
const output = [];
const action$ = ActionsObservable.of({ type: 'FIRST', type: 'SECOND' });
action$.subscribe(x => output.push(x));

expect(action$).to.be.an.instanceof(ActionsObservable);
expect(output).to.deep.equal([{ type: 'FIRST', type: 'SECOND' }]);
});

it('should be the type provided to a dispatched function', () => {
let middleware = createEpicMiddleware();
let reducer = (state, action) => {

0 comments on commit 25f50d0

Please sign in to comment.