Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

hatest

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hatest

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

latest
npmnpm
Version
0.1.2
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

node

FAQs

Package last updated on 25 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts