DEV Community

loading...

NodeJS Express Test-Driven API Development (TDD)

marius profile image Marius Espejo ・1 min read

The idea behind Test-Driven Development is quite simple.

  1. Write a test BEFORE you implement your next bit of functionality

  2. Write the minimal implementation needed to make your test pass

  3. Refactor and re-structure what you've written so far as needed

Then just keep cycling through those 3 steps as you build out the rest of your project!

In the following video, we learn about the basics of Test-Driven Development (TDD) specifically in the landscape of developing APIs. We use ExpressJS, Jest, and supertest as our frameworks of choice here, but the fundamentals that you learn from this video can be applied in almost any scenario, regardless of what NodeJS or testing framework you are using.

Discussion (0)

pic
Editor guide