On test driven development unit tests are written before writing the actual code. The unit tests consist of the functions describe
and it
which actually define a specification for functionality of the unit that they are testing.
It is my understanding that this specification should stand on its own. And by that I mean that when I read the specification I need no other resource to understand the unit it describes. I do not even need to read the code of the unit test. I just have to execute the unit test and look at the specification created.
Is this correct or wrong?
I am reading reliable javascript which introduces TDD and BDD and SOLID principles. I find hard to understand the unit functionality by reading the spec alone. Here is an example .
Can you make sense of that spec and write the code that passes the unit test ?
submitted by /u/liaguris
[link] [comments]