test-utils-docs
test-utils-docs copied to clipboard
feat: Add "Write Vue code that's easy to test" section
I was thinking of adding a section somewhere with several tips on writing testable code:
- Extract requests into services to simplify mocking.
- Extract complex methods and test them in isolation.
- Do not test implementation details (with examples).
- Build small things to have simpler test scenarios.
- Write tests before writing production code (the ultimate technique to write testable code 😆).
Also, we could point to some smells:
- Large "setup/arrange" blocks on each test.
- Breaking tests on a refactor (from my POV this is critical but I'm not 100% sure it would fit in this section).
Sounds cool? More ideas?
disclaimer: There's a lot of content on the internet about these topics. I think this section should be focused on Vue stuff with Vue examples, and then maybe links to well-established content.
These are definitely useful.
I think we should focus on the Vue specific things first, though - like you said, there is a lot of content out there for the other topics.
That said, I definitely like this idea.