Re:useStateMachine: A ½ kb state machine hook for React
by jameshart on Sunday May 23, 2021 @10:41AM
(#27255299)
The function you’re talking about would be a react functional component. I don’t think passing window.setInterval in as a prop to a react component is a particularly common approach to achieving component testability - though by all means give it a try.
I don’t think it’s ‘nonsensical’ though to suggest that it’s a fairly common practice in testing to not want your unit tests to actually set up recurring callbacks.
Isolating an external side effect to make it testable, as well as to align its abstraction with the one that your framework uses is a common pattern anyway.
I don’t think it’s ‘nonsensical’ though to suggest that it’s a fairly common practice in testing to not want your unit tests to actually set up recurring callbacks.
Isolating an external side effect to make it testable, as well as to align its abstraction with the one that your framework uses is a common pattern anyway.
I’m not sure why this angers you so much?