Hacker News new | ask | show | jobs
by turdnagel 2667 days ago
Along the way you might have some generic data transformation functions that require no notion of a request. They're just pure functions that transform data and can be easily unit tested. Seems nuts to mock a request just to test something like that.
2 comments

If they don't require a notion of a request then don't pass it to them?
Or you could just pass the function an optional tracing ID as an argument.
Or just keep logging / requests out of the pure functions, and leave it to the context around them. You can always have the pure functions return a `Result` or `Either` type, if you need information about a failure to be logged.