After bootstrapping my new application with my personal example NextJs application, I prepared the phrasing of test cases that should be passed to match the acceptance criteria of the first user story.
As a user, I want to write down my thoughts in a bullet list so that I can see them all in one place. #2
- [ ] the document is initially empty
- [ ] each bullet point has a unique id
- [ ] pressing enter exits the editing of the current bullet point, creates a new one below and enters its editing mode
- [ ] pressing escape discards the current changes, if nothing was written, the bullet point is removed
After that, I added some actual tests and wrote the code needed to pass them.
Finally, I updated the first test case with my expectations of what should happen if the 'Add' button is clicked twice.
I really like writing tests with the
@testing-library. It gives the reader a clear picture of what to expect without going into the implementation details.
The implementation will be part of the next update.