Browse Source

Improve error tests;

bjorn 8 years ago
parent
commit
611166ce36
2 changed files with 6 additions and 1 deletions
  1. 5 0
      tests/all.lua
  2. 1 1
      tests/map.lua

+ 5 - 0
tests/all.lua

@@ -10,6 +10,11 @@ describe('all', function()
     expect(#onError).to.equal(1)
   end)
 
+  it('produces an error if the parent errors', function()
+    local _, onError = observableSpy(Rx.Observable.throw():all(function(x) return x end))
+    expect(#onError).to.equal(1)
+  end)
+
   it('produces true if all elements satisfy the predicate', function()
     local observable = Rx.Observable.fromRange(5):all(function(x) return x < 10 end)
     expect(observable).to.produce({{true}})

+ 1 - 1
tests/map.lua

@@ -1,6 +1,6 @@
 describe('map', function()
   it('produces an error if its parent errors', function()
-    local observable = Rx.Observable.of(''):map(function(x) return x() end)
+    local observable = Rx.Observable.throw():map(function(x) return x end)
     expect(observable.subscribe).to.fail()
     expect(observable:map().subscribe).to.fail()
   end)