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.

Creating test-doubles with Sinon

Creating test-doubles with Sinon - JavaScript Tutorial

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

Start my 1-month free trial

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…

Contents