-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support schedulers within run #5619
Conversation
b878a61
to
36a32a3
Compare
3ee0ced
to
1b8a6c8
Compare
fakeTimer.tick(25); | ||
expect(actionHappened).to.be.true; | ||
sandbox.restore(); | ||
testScheduler.run(({ cold, expectObservable, time }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement to these tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll do a follow up to kill the name setImmediate
, as that's not really what this does anymore. setImmediate
is a failed proposal from back when RxJS 5 was under development 6 years ago. This is really doing microtask scheduling or next tick ..
Very nice work! Thanks @cartant! |
Description:
In #5607, an
animate
function was added to therun
helpers to enable the testing of theanimationFrames
observable.IMO, if we are going to extend the
TestScheduler
to facilitate the testing ofanimationFrames
, we might as well extend it so that theanimateFrameScheduler
is testable, too. And if that's done, we might as well make theasapScheduler
testable.This PR adds providers and delegates for
set
/clearImmediate
andset
/clearInterval
so that schedulers can be supported withinTestScheduler#run
in a manner similar to theanimationFrames
observable.The
AsyncScheduler.delegate
has been removed, as all delegation now happens via the providers.This test demonstrates the behaviour of the delegated implementation with the
TestScheduler
:asap
actions are executed before anyasync
actions on the same marbleanimationFrame
actions are executed when specified via theanimate
helperA bunch of tests are added to the
TestScheduler
'run mode' tests and some of the more high-levelAnimationFrameScheduler
,AsapScheduler
andQueueScheduler
tests are replaced with 'run mode'/marble tests.Related issue (if exists): None