Skip to content

Commit

Permalink
feat(ActionsObservable): ActionsObservable.from() now correctly ret…
Browse files Browse the repository at this point in the history
…urns an ActionsObservable as expected (#149)
  • Loading branch information
jdetle authored and jayphelps committed Nov 17, 2016
1 parent 7d2cf79 commit fd393a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ActionsObservable.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;
Expand Down
9 changes: 9 additions & 0 deletions test/ActionsObservable-spec.js
Expand Up @@ -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();
Expand Down

0 comments on commit fd393a1

Please sign in to comment.