0.1.2 • Published 7 years ago

hatest v0.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

hatest

HaTest

A node API testing tool similar to Supertest, based on Axios.

Getting Started

Install Hatest as an npm module and save it to your package.json file as a development dependency:

npm i hatest --save-dev

Once installed it can now be referenced by simply calling require('hatest')

Example

Hatest works with mocha, here is an example:

const hatest = require('hatest')
const express = require('express')
 
describe('simple', function() {
    it('test1', function () {
        const app = express()

        app.get('/', function(req, res) {
            res.send('hello')
        })

        return request(app)
            .get('/')
            .expect('hello')
            .end()
    })
})

API

  • .expect(200)

  • .expect(200, body)

  • .expect('Some body')

  • .expect({ someStr: String })

  • .expect('Content-Type', 'application/json')

  • .expect(fn)

  • .end(fn)

Notes

Inspired by supertest.

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago