unpack.lua 660 B

12345678910111213141516
  1. describe('unpack', function()
  2. it('produces an error if its parent errors', function()
  3. local observable = Rx.Observable.of(''):map(function(x) return x() end)
  4. expect(observable.subscribe).to.fail()
  5. expect(observable:unpack().subscribe).to.fail()
  6. end)
  7. it('fails if the observable produces an element that is not a table', function()
  8. expect(Rx.Observable.of(3):unpack().subscribe).to.fail()
  9. end)
  10. it('produces all elements in the tables produced as multiple values', function()
  11. local observable = Rx.Observable.fromTable({{1, 2, 3}, {4, 5, 6}}, ipairs):unpack()
  12. expect(observable).to.produce({{1, 2, 3}, {4, 5, 6}})
  13. end)
  14. end)