1234567891011121314151617181920 |
- 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()
- local _, onError = observableSpy(Rx.Observable.throw():distinct())
- expect(#onError).to.equal(1)
- 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)
|