29 lines
762 B
Lua
29 lines
762 B
Lua
describe('amb', function()
|
|
it('returns nil if it is passed nil', function()
|
|
expect(Rx.Observable.amb()).to.equal(nil)
|
|
end)
|
|
|
|
it('returns the Observable unchanged if it is the only one supplied', function()
|
|
expect(Rx.Observable.amb(Rx.Observable.fromRange(3))).to.produce(1, 2, 3)
|
|
end)
|
|
|
|
it('produces values from the first Observable to produce a value', function()
|
|
local a = Rx.Subject.create()
|
|
local b = Rx.Subject.create()
|
|
local onNext = spy()
|
|
local observer = Rx.Observer.create(onNext)
|
|
local amb = a:amb(b):subscribe(observer)
|
|
|
|
b:onNext(4)
|
|
a:onNext(1)
|
|
b:onNext(5)
|
|
b:onNext(6)
|
|
b:onCompleted()
|
|
a:onNext(2)
|
|
a:onNext(3)
|
|
a:onCompleted()
|
|
|
|
expect(onNext).to.equal({{4}, {5}, {6}})
|
|
end)
|
|
end)
|