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
20 lines
661 B
Lua
20 lines
661 B
Lua
describe('distinct', function()
|
|
it('does not produce the same value twice', function()
|
|
local observable = Rx.Observable.fromTable({1, 1, 2, 1, 3, 3, 2, 1, 4}, ipairs):distinct()
|
|
expect(observable).to.produce(1, 2, 3, 4)
|
|
end)
|
|
|
|
it('produces an error if its parent errors', function()
|
|
expect(Rx.Observable.throw():distinct()).to.produce.error()
|
|
end)
|
|
|
|
it('completes when its parent completes', function()
|
|
local subject = Rx.Subject.create()
|
|
local onCompleted = spy()
|
|
subject:distinct():subscribe(nil, nil, onCompleted)
|
|
expect(#onCompleted).to.equal(0)
|
|
subject:onCompleted()
|
|
expect(#onCompleted).to.equal(1)
|
|
end)
|
|
end)
|