Permalink
Browse files

feat(ActionsObservable): `ActionsObservable.from()` now correctly ret…

…urns an ActionsObservable as expected (#149)
  • Loading branch information...
jdetle authored and jayphelps committed Nov 17, 2016
1 parent 7d2cf79 commit fd393a1adf359381c98ca494bc5dc2cac80f6d07
Showing with 14 additions and 0 deletions.
  1. +5 −0 src/ActionsObservable.js
  2. +9 −0 test/ActionsObservable-spec.js
@@ -1,12 +1,17 @@
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { from } from 'rxjs/observable/from';
import { filter } from 'rxjs/operator/filter';

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

static from(actions, scheduler) {
return new this(from(actions, scheduler));
}

constructor(actionsSubject) {
super();
this.source = actionsSubject;
@@ -17,6 +17,15 @@ describe('ActionsObservable', () => {
expect(output).to.deep.equal([{ type: 'FIRST' }, { type: 'SECOND' }]);
});

it('should support ActionsObservable.from(...actions, scheduler)', () => {
const output = [];
const action$ = ActionsObservable.from([{ 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' }]);
});

describe('ofType operator', () => {
it('should filter by action type', () => {
let actions = new Subject();

0 comments on commit fd393a1

Please sign in to comment.