Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marmelab/integration-test-rest-api
Integration test on Node API
https://github.com/marmelab/integration-test-rest-api
frisby integration-testing jest joi nodejs test
Last synced: 27 days ago
JSON representation
Integration test on Node API
- Host: GitHub
- URL: https://github.com/marmelab/integration-test-rest-api
- Owner: marmelab
- License: mit
- Created: 2020-09-24T11:52:59.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-09-24T11:54:01.000Z (over 4 years ago)
- Last Synced: 2025-01-04T20:30:02.731Z (28 days ago)
- Topics: frisby, integration-testing, jest, joi, nodejs, test
- Language: JavaScript
- Homepage:
- Size: 83 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Integration test on Node API
This project show how to use [frisby](https://github.com/vlucas/frisby) and [joi](https://github.com/sideway/joi) to test your Node API.
## Prerequisites
- Node 14.x or more
- Yarn 1.x## Start the API
```sh
yarn # Install the depyarn dev # start the API on localhost:3000 in watch mode
yarn start # start the API on localhost:3000 (production)
```Routes:
```
GET -> / -> Return Hello WorldGET -> /users -> Return the list of all users
GET -> /users/:id -> Return the user by this :id
```## Unit test
```sh
yarn test:unit:watch # Start unit test in watch modeyarn test:unit # Start unit test, CI command
```The tests can be found in `./src/**/*.spec.js`
## Integration test
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.
```sh
yarn test:integration:watch # Start integration test in watch modeyarn test:integration:ci # Start integration test, CI command
```The tests can be found in `./integration-tests/**/*.spec.js`