Refactor the Code
Learn how to refactor repository code and test routes.
We'll cover the following...
What is left to test?
We have no tests for our Repository
class, which handles all the database work. We also don’t have tests for our routes.
We have several options for testing here, but we have to do some refactoring before we can test either of them. For starters, we should move our routes out of our main application into separate classes to test them more easily. But should we refactor code only to gain better testability?
The answer is yes, we should. There are, of course, pros and cons to that, but in general, this approach makes sense. ...
Access this course and 1400+ top-rated courses and projects.