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-doubles with Sinon - JavaScript Tutorial
From the course: JavaScript: Test-Driven Development (ES6)
Creating test-doubles with Sinon
- [Instructor] Over the past few videos, we've used TDD with integration testing to start building a database communication layer that'll be used throughout the rest of the app. While our database communication layer currently contains only one function, the development of any other similar functions, such as creating a new user or fetching some other resource, such as an article info if this were a blog, would be developed using very similar methods to those that were covered in the previous section. For now we're going to move on and take a look at how to build out our server endpoint using integration testing. So to start, let's install a library called sinon which will help us create test doubles in our integration tests. And we do that by running npm install --save-dev sinon, S-I-N-O-N. And once we've done that, let's open up our server.test.js file and start writing some tests. So since we know some of the…
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.