DEV Community

Discussion on: Code consistency vs using new features

Collapse
 
joshcheek profile image
Josh Cheek

In general, I'd rather use a useful feature than keep writing things in a confusing or tedious old style. However, the "consistent" example here is much better than the "new feature" example. However, the example doesn't really make sense: why would the test not know the expected result? Eg if it should be 10, then it shouldn't be null, presumably only one of these is the correct behaviour. And in the case of a test like that, if the pattern was showing up often enough to talk about consistency, then, I'd make a helper function to encapsulate all the duplication.