From the course: JavaScript: Test-Driven Development (ES6)

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Creating test helpers

Creating test helpers

- [Instructor] So now that we've mostly gone through the first TDD cycle with integration testing, which by the way didn't involve any unit testing iterations since in this case those wouldn't really have added any value above and beyond our integration tests, you might notice that this code that we've written for our tests is kind of a mess. Well it's not necessarily a mess but it's certainly got a lot more code than we'd like to have inside our tests. Specifically, there's no reason that we should have all the technical details of setting up and tearing down our data base directly in our test file. For one, this means that we'll have to repeat all this code for every test that needs it, and it's also just a lot of code that we don't really care that much about here. All we care about here is that the database has the correct data before and after our production code has run. So then, what we're going to do is refactor this code…

Contents