3 ms·
I read the OP's comment as: you can write the "then" functions as pure functions, and they won't have any side effects; those will then be isolated inside the c
by danmaz74 11y ago
I read the OP's comment as: you can write the "then" functions as pure functions, and they won't have any side effects; those will then be isolated inside the code that resolves the promise - code that you usually don't write yourself as it is part of some library, as with "fetch(...)" for making an HTTP request.
- dangoor 11y agoSure, the `then`s could be pure functions but the whole point of my blog post is that I'd like to be able to test code that calls `fetch`. That would be possible if the actual side effecting operation is deferred to later, and not just the result.