Reactive-Extensions / RxJSKoans

RxJS Koans
Apache License 2.0
373 stars 101 forks source link

Compatible with latest RxJS? #8

Open dannybloe opened 8 years ago

dannybloe commented 8 years ago

Hi there,

I'm going through the tutorials and got stuck at 04_about_time. I think that the tests are too old for the current RxJS version since there doesn't seem to be a Scheduler.timeout.scheduleWithRelative anymore.

AloofBuddha commented 8 years ago

Seconding this, I'm having the same issue. Rx.Scheduler.timeout appears to be undefined in my version of RxJS (4.0.1). I worked around the problem by replacing Rx.Scheduler.timeout with Rx.Scheduler.default and replacing scheduleWithRelative with scheduleFuture and an additional dummy state value. The final (passing) test follows:

asyncTest('launching an event via a scheduler', function () {
  var received = '';
  var delay = 400; // Fix this value
  Scheduler.default.scheduleFuture('global', delay, function () {
    received = 'Finished';
  });

  setTimeout(function () {
    start();
    equal('Finished', received);
  }, 500);
});

I would push this change myself, except I am currently an Rx neophyte and am a bit hesitant to 'fix' something I'm only starting to grok. Perhaps the simplest temporary solution is to fix the version of RxJS within package.json?

douglasduteil commented 8 years ago

Can be closed ?

AloofBuddha commented 8 years ago

The fix looks good to me.