GithubHelp home page GithubHelp logo

abenteuerzeit / supertests Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 129 KB

Api testing using supertest (mocha & chai), and generating dummy user data

JavaScript 99.32% HTML 0.42% CSS 0.26%
api chai dummy-data dummy-data-generator fake-users mocha supertest supertest-mocha-chai

supertests's Introduction

API Testing using SuperTest

Implementation of API testing using SuperTest tutorial from Hackernoon

Installation

First, clone the repository with the 'clone' command, or just download the zip.

git clone https://github.com/abenteuerzeit/SuperTests.git

Then, install the project dependencies.

npm install

Users Database

The users database is generated in the db.js file. This file is used by the server to generate the database. It contains a list of users with their name, email and password, and other information.

Every time the server is restarted, the database is regenerated with different users and dummy data.

The users databse is tested using Chai and Mocha in the test folder. To run all the tests, use the following command:

npm test

To run the tests for the users database, use the following command:

npm run test-db

To run the tests for the API endpoints, use the following command:

npm run test-api

Running the Server

To run the server, use the following command:

npm start

The server will be running on port 3000.

API Endpoints

The API endpoints are listed below.

GET /users

Returns a list of all users. You can navigate through the pages using the page query parameter.

curl http://localhost:3000/users

or enter the following URL in your browser:

http://localhost:3000/users

supertests's People

Contributors

abenteuerzeit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.