Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Commit

Permalink
componentFromStream can potentially throw EmptyError: no elements in …
Browse files Browse the repository at this point in the history
…sequence (#309)

* Add note about stream closing in `componentFromStream()`

* Update note about stream closing in `componentFromStream()`

* Add proof for `EmptyError` in `componentFromStream`

* Remove note in favour of PR description.
  • Loading branch information
avocadowastaken authored and istarkov committed Jan 29, 2017
1 parent e948653 commit bed9c41
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/packages/recompose/__tests__/componentFromStream-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,23 @@ test('complete props stream before unmounting', t => {
wrapper.unmount()
t.is(counter, 0)
})

test('completed props stream should throw an exception', t => {
const Div = componentFromStream(props$ => {
const first$ = props$
.filter(() => false)
.first()
.startWith(null)

return props$.combineLatest(
first$,
props1 => <div {...props1} />
)
})

const wrapper = mount(<Div />)

t.is(wrapper.find('div').length, 1)

t.throws(() => wrapper.unmount(), /no elements in sequence/)
})

0 comments on commit bed9c41

Please sign in to comment.