DEV Community

Discussion on: Commenting: where?

 
dvddpl profile image
Davide de Paolis

another reason why comments should be minimal, even to explain the WHY above is that we should have Unit Tests! Unit Tests are uptodate documentation of the edge cases and weird behaviours of a method.

test("when sum would be odd, method returns an even number anyway", ()=>{
const result = noOddsAdd(4,5);
expect(result).toBe(10)
))
Enter fullscreen mode Exit fullscreen mode