Practical Microservices: DI suggestion (p. 37, etc.)

I’d suggest that since the code is using the dependency-injection pattern already, sources of impurity like uuid/v4 should be injected to allow testability and make the overall functions pure where possible. Thus the dependencies should include a function with signature () => string rather than the concrete function uuid/v4.

I agree with you. With the concrete function being used, controlling the ID in test has to resort to unholy mocking practices. Thank you for pointing it out.