Giter VIP home page Giter VIP logo

testing-rest-api-jwt-node.js-mongodb's Introduction

Automated API tests in Postman - Chai Assertion Library

This is a project to demonstrate the Rest API testing process in a locally set environment. The concept applied is CRUD. Chai Assertion Library is used.

Link to my postman collections


Localhost source

More information about the tested project can be found here

Features

API calls are divided into 4 folders: - auth, - city, - profile, - users

auth tests

-	GET /		- it should GET home API url
-	POST /login	- it should NOT POST login if body is empty
-	POST /login	- it should GET token
-	POST /register	- it should POST register	
-	POST /register	- it should NOT POST a register if email already exist	
-	POST /verify	- it should POST verify
-	POST /verify	- it should NOT POST verify if user is already verified
-	POST /forgot	- it should POST forgot
-	POST /reset	- it should POST reset
-	GET /token	- it should NOT be able to consume the route since no token was sent
-	GET /token	- it should GET a fresh token

city tests

-	POST /login		- it should GET token (city)
-	GET /cities		- it should NOT be able to consume the route since no token was sent
-	GET /cities		- it should GET all the cities
-	GET /cities?filter...	- it should GET the cities with filters
-	POST /cities		- it should NOT POST a city without name
-	POST /cities		- it should POST a city
-	POST /cities		- it should NOT POST a city that already exists
-	GET /cities/:id		- it should GET a city by the given id
-	PATCH /cities/:id	- it should UPDATE a city given the id
-	DELETE /cities/:id	- it should DELETE a city given the id

profile tests

-	POST /register	- it should POST user
-	POST /login	- it should GET token (profile)
-	GET /profile	- it should NOT be able to consume the route since no token was sent
-	GET /profile	- it should GET profile
-	PATCH /profile	- it should NOT UPDATE profile empty name/email
-	PATCH /profile	- it should UPDATE profile	
-	PATCH /profile	- it should NOT UPDATE profile with not valid URL´s
-	POST profile/changePassword	- it should NOT change password
-	POST profile/changePassword	- it should NOT change a too short password	
-	POST profile/changePassword	- it should change password

user tests

-	POST /login	- it should GET token as admin (user)
-	POST /users	- it should POST user
-	POST /login	- it should GET token as user (user)
-	GET /users	- it should NOT be able to consume the route since no token was sent
-	GET /users	- it should GET all the users
-	GET /users?filter...	- it should GET the users with filters
-	POST /users	- it should NOT POST a user without name
-	POST /users	- it should POST a user
-	POST /users	- it should NOT POST a user with email that already exists
-	POST /users	- it should NOT POST a user with not known role
-	GET /users/:id	- it should GET a user by the given id
-	PATCH /users/:id	- it should UPDATE a user given the id
-	PATCH /users/:id	- it should NOT UPDATE a user with email that already exists
-	PATCH /users/:id	- it should NOT UPDATE another user if not an admin
-	DELETE /users/:id	- it should DELETE a user given the id

N|Solid

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.