Comment by lelandfe
2 hours ago
> Um …duh? Get out a calculator. Consult a reference, etc. Otherwise compute the result
Article:
> This is a perfectly lovely test. But think: everything in those describe blocks had to be written by hand. The programmer first had to decide what properties they cared about... then also had to say explicitly what state they expected each field to be in. Then they had to type it all out.
The article is about not getting out the calculator.
> The programmer first had to decide what properties they cared about... then also had to say explicitly what state they expected each field to be in.
Yes, this is the point of testing. You have to think about what you're about to write! Before you write it! The technique in the article completely discards this. It's a terrible way to write tests.