-
-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
RFCSome new feature that should be discussedSome new feature that should be discussed
Description
Proposal
Now patronum delay, interval, debounce, time works with global time functions (window.setTimeout, window.setInterval, window.Date.now) what make testing of some features impossible. The solution is create API where developer can manually set implementations of setTimeout/setInterval
Someting like this:
const $timers = createStore({ setTimeout: (cb) => cb() });
const startDelay = createEvent();
const triggered = delay({ source: startDelay, timeout: 200, timers: $timers });
Motivation
- Developer can set their own implementations of time functions (this make testing very easy)
- This solution much better than jest fake timers, 'cause it can't create race condition even in theory
Related links:
Metadata
Metadata
Assignees
Labels
RFCSome new feature that should be discussedSome new feature that should be discussed