From the course: JavaScript: Test-Driven Development (ES6)
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Test doubles - JavaScript Tutorial
From the course: JavaScript: Test-Driven Development (ES6)
Test doubles
- [Instructor] Before we go any further in talking about integration testing, we need to talk about a very important topic in test-driven development in general, and this is something called test doubles. So let's say again that we're writing a rest API that uses MongoDB or some other database to store application data. When we try to write tests for the parts of our codebase that interact with our database, we run into a small dilemma. Our tests require our code to be interacting with an actual database. And speed is the main concern in cases like this, since running tests that require communication with external services such as databases, especially if we're communicating over a network, drastically increases the time it takes for our test to run. And when we're doing test-driven development, it's absolutely critical that our tests run as quickly as possible, since otherwise we'll spend a lot of our valuable…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.