background
Home / Portfolio / Unit Test & Integration Test
PORTFOLIO

Unit Test & Integration Test

Challenge Binar Academy Kampus Merdeka Batch 3 - Chapter 6. Build a simple unit test and integration test with Jest and Supertest.

#ExpressJS  #Jest  #Supertest  #Binar Challenge  

Unit Test and Integration Test

Build a simple unit test and integration test with Jest and Supertest.

Binar Challenge - Backend JavaScript - Chapter 6

This project is one of Challenge from Binar Academy Kampus Merdeka.

The challenge is to create a simple unit test and integration test with Jest and Supertest.

This challenge is a continuation of the previous challenge, which is Postman Collection Documentation.

Source code : GitHub / GitLab

Requirements

  • Unit Test
  • Integration Test
  • CI/CD with GitHub Actions

Features

  • User Game CRUD
  • User Game Biodata CRUD
  • User Game History CRUD
  • Authentication
  • Generate documentation from Postman collection
  • Unit Test
  • Integration Test
  • CI/CD with GitHub Actions, not working due Vercel's serverless function.

Tech Stack

Prerequisites

  • NodeJS
  • PostgreSQL
  • sequelize-cli - Sequelize command line interface, make sure you install it globally.
  • nodemon - Nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application. Make sure you install it globally.

Installation and Usage

Clone the repository

1git clone https://github.com/raprmdn/binar-chapter6.git
bash

Install dependencies

1npm install
bash

Copy .env.example to .env

1cp .env.example .env
bash

Configure the required environment variables in .env file

Create database

1sequelize db:create
bash

Run migration

1sequelize db:migrate
bash

Run the Unit Test and Integration Test

1npm test
bash
Because Vercel is a serverless function, the CI/CD with GitHub Actions is not working. 🙏

Screenshots

Coverage
Coverage result

Next Challenge

The next challenge is integration with Google and Facebook OAuth and Upload Image/File. Check it out here.