Testtp
A library that simplifies testing with node http.Server's or listeners like express.
It exposes node-fetch
(bitinn/node-fetch) to get data from the test server.
Install
npm install --save-dev testtp
Usage
A sample jest
test.
var http = var express = var fetch = var createTestServer = ; ;
API
testtp(server [, cb])
returns a Promise instance to create Testtp
instance
- arg
server
a http.Server (or express etc.) instance - arg
cb
optional callback withTesttp
instance
Class: Testtp
_server
Stores the node http.Server instanceport
Stores the portaddress
Stores the address,127.0.0.1
url
Stores the full url,http://127.0.0.1:1337
close([cb])
Closes the connection (Callback or Promise)[HTTP_METHOD](path)
Requests the test server (node-fetch
)
License
MIT