test-listen-destroy

1.0.0 • Public • Published

test-listen-destroy

Uses test-listen but destroys http server when request is done.

This allows a single assertion per call.

js-standard-style downloads Greenkeeper badge

example

const listen = require('./')
const test = require('tape')
const request = require('request-promise')
 
test('server', async (t) => {
  t.plan(1)
  const fn = (req, res) => res.end('hello')
  const url = await listen(fn)
  const res = await request(url)
  t.deepEqual(res, 'hello', 'server returns hello')
})

license

Apache License, Version 2.0

Readme

Keywords

none

Package Sidebar

Install

npm i test-listen-destroy

Weekly Downloads

0

Version

1.0.0

License

Apache-2.0

Last publish

Collaborators

  • jameskyburz