项目作者: WarleyGabriel

项目描述 :
API tests with Jest and SuperTest
高级语言: TypeScript
项目地址: git://github.com/WarleyGabriel/api-tests-jest-supertest-example.git
创建时间: 2019-06-22T13:12:10Z
项目社区:https://github.com/WarleyGabriel/api-tests-jest-supertest-example

开源协议:MIT License

下载


API tests with Jest and SuperTest

jest
Commitizen friendly
Action Status
License

This project is an example of API tests using TypeScript, Jest and SuperTest.
We are using FakeRestAPI.Web as a system.

Features

Requirements

Getting Started

Install the dependencies:

  1. npm install

Compile TypeScript:

  1. npm run build

Run api tests:

  1. npm run test
  1. PASS dist/specs/Books.test.js (7.384 s)
  2. Managing books
  3. /GET - All books (1096 ms)
  4. /GET - An specific book (1101 ms)
  5. /POST - A new book (1217 ms)
  6. /PUT - Update a book (1229 ms)
  7. /DELETE - Remove a book (1228 ms)
  8. /CONTRACT - Check contract of getting books (1076 ms)
  9. Test Suites: 1 passed, 1 total
  10. Tests: 6 passed, 6 total
  11. Snapshots: 0 total
  12. Time: 8.16 s, estimated 13 s
  13. Ran all test suites matching /.\/dist\/specs\/Books.test.js/i.

Watch mode

We also have watch mode for Jest and TypeScript:

  1. npm run build:watch
  2. npm run test:watch

Prettier and Eslint

Run to format the code:

  1. npm run code:format

Commit

We use the best practices for message’s commit, using Commit lint and Commitizen we can generate changelogs automatically.

Run npm run commit and commitizen will help you.