RxLua/tests/pack.lua
2016-10-15 10:31:23 -07:00

13 lines
499 B
Lua

describe('pack', function()
it('produces an error if its parent errors', function()
local observable = Rx.Observable.of(''):map(function(x) return x() end)
expect(observable.subscribe).to.fail()
expect(observable:pack().subscribe).to.fail()
end)
it('wraps elements of the source in tables', function()
local observable = Rx.Observable.fromTable({4, 5, 6}, ipairs, true):pack()
expect(observable).to.produce({{{4, 1, n = 2}}, {{5, 2, n = 2}}, {{6, 3, n = 2}}})
end)
end)