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

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Testing an endpoint: The basic approach

Testing an endpoint: The basic approach - JavaScript Tutorial

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

Start my 1-month free trial

Testing an endpoint: The basic approach

- [Instructor] So now that we have the basic specifications for our userinfo endpoint, let's look at how to write an integration tests that captures these requirements. So first, we're going to go into our project and create a source directory to hold our code. So create a new folder called source. And then inside this directory, we're going to create a few files. The first file will create will call server.js, and this will hold our server code. And then we'll create another file called server.test.js, which will contain the tests for our server code. And then we'll create a file called dB.js, which will contain logic for dealing with our database. And finally, will have a file called db.test.js, which will have tests for our DB file. So before we start writing any tests, let's take a moment to think about our plan of attack with regards to testing this thing. We have two main conflicting needs here. Our first need is…

Contents