You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the tests included only check for quite trivial behaviours but don't really guarantee the correctness of the original code in various aspects.
Additional tests are needed to check:
The functions passed as hooks are what is actually being called when running the hook. This should involve creating some mock or stub functions and then checking that they have been called with some assertion. As they currently are written most tests would pass even if runHook simply returned the passed argument plus 3 ignoring everything else.
That actions actually run. Currently the tests only verify that actions are stored and that runActionresolves but they don't check anything at all about the actions actually being executed. Again, some mocks should be setup and used to verify that they have actually been called.
That the "priority" argument works. Currently there's no test at all that verifies in any way the order/priority in which the functions are called. This applies to both hooks and actions.
A number of additional edge cases. It would be useful to have tests that check things like calling runHook with no hooks added, or calling removeHook when no hook has been added, or removing/adding hooks from inside a hook function (what is the expected behaviour here? is it documented anywhere?), or some other similar infrequent but not unthinkable cases.
Note that all these things are probably correct in the code now. I'm not saying there are any errors right now, but I'm also not saying that there aren't. What I'm saying is that the included tests are too weak to be useful for anything; they offer very little or no safety at all.
The text was updated successfully, but these errors were encountered:
Currently the tests included only check for quite trivial behaviours but don't really guarantee the correctness of the original code in various aspects.
Additional tests are needed to check:
runHook
simply returned the passed argument plus 3 ignoring everything else.runAction
resolves but they don't check anything at all about the actions actually being executed. Again, some mocks should be setup and used to verify that they have actually been called.priority
" argument works. Currently there's no test at all that verifies in any way the order/priority in which the functions are called. This applies to both hooks and actions.runHook
with no hooks added, or callingremoveHook
when no hook has been added, or removing/adding hooks from inside a hook function (what is the expected behaviour here? is it documented anywhere?), or some other similar infrequent but not unthinkable cases.Note that all these things are probably correct in the code now. I'm not saying there are any errors right now, but I'm also not saying that there aren't. What I'm saying is that the included tests are too weak to be useful for anything; they offer very little or no safety at all.
The text was updated successfully, but these errors were encountered: