4 ms·
If you make the function pure it will be easier to test. Pass the moving parts as function parameters, then you can pass in the mocks in the actual functions wh
by z3t4 11mo ago
If you make the function pure it will be easier to test. Pass the moving parts as function parameters, then you can pass in the mocks in the actual functions when testing. Example:
f = () => a+b
refactor for easier testing
f = (a, b) => a+b
in your test you can now mock a and b