Prevent Infinite Loop in m.prop.combine

Passing a non-stream value to combine or merge will result in uncaught
errors that are not descriptive enough to be helpful.
This commit is contained in:
Douglas Brown 2016-09-09 18:05:25 -04:00
parent 67bb288e01
commit fd0d7059df
2 changed files with 16 additions and 0 deletions

View file

@ -171,6 +171,20 @@ o.spec("stream", function() {
o(b()).equals(undefined)
})
o("combine will throw with a helpful error if given non-stream values", function () {
var spy = o.spy()
var a = Stream(1)
var thrown = null;
try {
var b = Stream.combine(spy, [a, ''])
} catch (e) {
thrown = e
}
o(thrown).notEquals(null)
o(thrown.constructor === TypeError).equals(false)
o(spy.callCount).equals(0)
})
})
o.spec("merge", function() {
o("transforms an array of streams to an array of values", function() {