Fixed wrong test codes with the assertion. Changed the behaviors of the following functions caused by argument types, to raise an error in the creation phase. - Observable.defer - Observable:buffer - Observable:elementAt - Observable:skipLast - Observable:takeLast - Observable:window
18 lines
684 B
Lua
18 lines
684 B
Lua
describe('last', function()
|
|
it('produces an error if its parent errors', function()
|
|
local observable = Rx.Observable.of(''):map(function(x) return x() end)
|
|
expect(observable).to.produce.error()
|
|
expect(observable:last()).to.produce.error()
|
|
end)
|
|
|
|
it('produces no elements if its parent produces no elements', function()
|
|
local observable = Rx.Observable.create(function(observer) return observer:onCompleted() end):last()
|
|
expect(observable).to.produce.nothing()
|
|
end)
|
|
|
|
it('produces the last element of its parent and immediately completes', function()
|
|
local observable = Rx.Observable.fromRange(5):last()
|
|
expect(observable).to.produce(5)
|
|
end)
|
|
end)
|