Skip to content

An example repository which provides the necessary boilerplate for a reusable and maintainable jest test framework

License

Notifications You must be signed in to change notification settings

jmfiola/jest-api-test-typescript-example

Repository files navigation

Build Status Forks Stargazers Issues MIT License LinkedIn


Logo

Jest Api Test Framework: A TypeScript Example

This is an example repository which provides the necessary boilerplate code for a reusable and maintainable jest api test framework using TypeScript.
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

This is a basic test framework that hits the Chuck Norris Jokes API following 3 core values:

  1. Endpoint functionality should be wrapped by a class method which is abstracted as much as possible 🌌

  2. Those class methods should be unit tested 🧪

  3. Actual API tests will then import those class methods to interact with the live API 🔎

(back to top)

Built With

(back to top)

Getting Started

Prerequisites

You will want the latest version of npm installed. For reference, this project was developed with npm version 8.5.1.

npm install npm@latest -g

Installation

  1. Clone the repo
    git clone https://github.com/jmfiola/jest-api-test-typescript-example.git
  2. Install NPM packages
    npm install
    

(back to top)

Usage

  1. Run the unit tests for the framework with code coverage
    npm run unit:test
    
  2. Run the functional tests which actually hit the live Chuck Norris API
    npm run functional:test
    

You can use this framework as a starting point for whatever API tests you would like to run. This framework allows for the flexibility of running tests which have free range with what headers they use, what routes they call, etc. whilst also providing easy-to-use, reusable, unit tested class methods. This makes the tests a lot more accessible to test writers and framework maintainers!

(back to top)

Roadmap

  • Dockerization
  • Reporting Integration
  • Tag-based test collection

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. My venmo is @Jacob-Fiola! 😉

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

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

(back to top)

Contact

Project Link: https://github.com/jmfiola/jest-api-test-typescript-example

Email: jmfiola21@gmail.com

(back to top)