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

componentFromStream can potentially throw EmptyError: no elements in sequence #309

Merged
merged 4 commits into from
Jan 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/)
})