Skip to content

fredysiswanto/template-api-testing-use-jest

Repository files navigation


Logo

Testing API with Jest + Supertest

A simple and extensible template for API testing using Jest and Supertest.
Ideal for quick setup and custom automation scripting.


About the Project

This repository provides a ready-to-use template for testing RESTful APIs using:

Directory Structure

Directory Structure

Usage

Run all tests

pnpm run test

Generate starter testing files

node scripts/cli <file-name or api-name> --test --api
  • --test: Generate a sample testing file (placed under test/)
  • --api: Generate an API helper function file (placed under src/api/)

Example:

node scripts/cli product --test --api

Will create:

  • test/product.test.js
  • src/api/product.js

Example Test Report:

Sample Report

How to Write Your API Tests

Check out this YouTube Demo Playlist


Getting Started

Prerequisites

Make sure you have Node.js and npm installed:

node -v
pnpm -v

Clone the Repository

git clone https://github.com/fredysiswanto/template-api-testing-use-jest.git
cd template-api-testing-use-jest

Install Dependencies

pnpm install

You're ready to start writing tests!


License

Distributed under the MIT License. See LICENSE for more information.


Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve the template.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors