Skip to content

marialuisacp/node-customers-api-tests

Repository files navigation

Customers API

JavaScript NodeJS Express.js NPM Heroku MongoDB Mocha

Deploy status

Heroku-pipe

Tests coverage

Statements Branches Functions Lines
Statements Branches Functions Lines

Overview

This project is a customers API built in NodeJs. The project access to non relational database using MongoDB. Below you see the main steps to run project and run automatization tests. The main libraies and resources used in this project was:

💻 - Development

✅ - Testing

📄 - Contract Testing

Directory structure

node-customers-api-tests/
├── __mocks__/
│     └── ...
├── __tests__/
│     ├── unit/
│     │    └── ...
│     └── contract/
│          └── ...
├── coverage/
│     └── ...
├──  .nyc_output
│     └── ...
├── docs/
│     ├── [DOCUMENTATION FILES]
│     └── ...
├── dev_scripts/
│     ├── output/
│     │    └── ...
│     └── [SCRIPTS FILES]
├── src/
│     ├── config/
│     │    ├── [CONFIG FILES]
│     │    └── ...
│     ├── routes/
│     │    ├── [ROUTES FILES]
│     │    └── ...
│     ├── services/
│     │    ├── [SERVCES FILES]
│     │    └── ...
│     ├── controllers/
│     │    ├── [CONTROLLERS FILES]
│     │    └── ...
│     ├── utils/
│     │    ├── [UTILS FILES]
│     │    └── ...
│     └── index.js
├── .gitignore
├── LICENSE.md
├── package-lock.json
├── package.json
└── README.md

Get Started

First is important to know that this project contains environment variables, that you have use. The local variables are in .env.local and production enviroment variables are in .env.prod. So, to setup your development environment, run:

cp .env.local .env

Necessary variables enrironments:

UI_URL_APP=''
MONGO_DB_URI=''
MONGO_DB_NAME=''
USER_API_AUTH=''
PASS_API_AUTH=''

Install dependencies

First, install dependencies:

npm install

Run

To run the project, you can execute this command below:

npm start

Quality and test automation

See below the project's unit test coverage and how to run the tests:

Lines Statements Branches Functions

Tests

To execute unit tests, run:

npm run test

Image unit test results

To run coverage to unit tests, run:

npm run coverage

Image unit test results

To run contract tests, run:

npm start

and in other terminal, run:

npm run contract

Image unit test results

Contact

Created by: @marialuisacp - contato@malu.dev

About

This project is a example Customers API built with NodeJs with unit and contract tests.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published