2

I am trying to do unit testing in RxJS 5 and I am completely unable to do so from what is explained in the documentation. I also tried to fallback on RxJS 4 which didn't work either since the defer operator doesn't take a scheduler.

How would I go about testing the following case:

// a.js

module.exports = Rx.Observable.defer(() => Promise.resolve('test'))

// b.js

const a = require('a')

module.exports = a().repeatWhen(notifications => notifications.delay(5000))

I am trying to test both files.

Note: the real implementation of a doesn't always return the same value

rochdev
  • 360
  • 1
  • 5
  • Possible duplicate of [The right way to test rxjs](https://stackoverflow.com/questions/41779910/the-right-way-to-test-rxjs) – Mark van Straten Jul 17 '17 at 12:25
  • Thanks @MarkvanStraten I went with this approach for the second file but for the first one I was unable to find a cleaner approach than manually subscribing and calling `done()` since the promise resolves asynchronously. – rochdev Jul 21 '17 at 11:21

0 Answers0