123456789101112131415 |
- describe('average', function()
- it('errors when its parent errors', function()
- local _, onError = observableSpy(Rx.Observable.throw():average())
- expect(#onError).to.equal(1)
- end)
- it('produces a single value representing the average of the values produced by the source', function()
- expect(Rx.Observable.fromRange(3, 9, 2):average()).to.produce(6)
- expect(Rx.Observable.fromTable({-1, 0, 1}):average()).to.produce(0)
- end)
- it('produces nothing if there are no values to average', function()
- expect(Rx.Observable.empty():average()).to.produce.nothing()
- end)
- end)
|