This project show how to use frisby and joi to test your Node API.
- Node 14.x or more
- Yarn 1.x
yarn # Install the dep
yarn dev # start the API on localhost:3000 in watch mode
yarn start # start the API on localhost:3000 (production)
Routes:
GET -> / -> Return Hello World
GET -> /users -> Return the list of all users
GET -> /users/:id -> Return the user by this :id
yarn test:unit:watch # Start unit test in watch mode
yarn test:unit # Start unit test, CI command
The tests can be found in ./src/**/*.spec.js
These command start the API in production node (yarn start
), wait for it to be launched (start-server-and-test
dependency) and start the integration tests.
yarn test:integration:watch # Start integration test in watch mode
yarn test:integration:ci # Start integration test, CI command
The tests can be found in ./integration-tests/**/*.spec.js