We used several technologies to write tests for both “happy” and “sad” paths of:
We also saw how TDD can be used at the server level to guide the implementation of the server code:
In this course we moved from the feature level to the server level for our TDD approach. When working with persistent data, you will need to continue down the stack to the model layer. We’ve updated the test from the initial exercise in messages-test.js to the right.
Again, we are checking that a valid message is saved. However, instead of checking the returned page contains the new message, we are checking the message is saved to the database layer.
Run the test using
This test fails, since we have not yet implemented the model layer, which is our next step as a developer.