Skip to content

pequena API em node.js e express para aprender o um pouco mais sobre o TDD. esta API Segue o padrão REST e é guiado por testes, seguindo o padrão TDD (Test Driven Developme).nt

Notifications You must be signed in to change notification settings

SauloAssisEngMec/Construindo-API-Testavel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

how to apply TDD using nodeJs and express

In this project I will create a small system for a virtual store that will cover topics such as:

  1. How to build modularized and decoupled applications
  2. How to integrate with NoSQL database using MongoDB
  3. How to test Javascript applications with Test-driven-development
  4. Why testing facilitates development
  5. How to design APIs following the REST standard
  6. How to provide API authentication and security

in thi scase I will approach outside-in test

I will test from the outside in, that is, we will start with integration tests and move on to unit tests

I will use Mocha: módulo que ira executar as suites de teste.

Mocha: the model that will runner test suites. Chai and sinon: the models that will be used to make assertions. Supertest: the model that will be used to emulate and abstract http request.

starting with Integration test

We will create routes an http req and res guided by integration tests, so it will be possible to validate the behavior.

In this case we will need supertest do make fake http request defined in mocha.config in integratio directory

unit test

  • We will create controllers guided by unit tests, so it will be possible to validate the behavior separately from our system itself.

  • we will use sinonjs to create spies, stubs e mocks, which will allow you to isolate the unit test

About

pequena API em node.js e express para aprender o um pouco mais sobre o TDD. esta API Segue o padrão REST e é guiado por testes, seguindo o padrão TDD (Test Driven Developme).nt

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published