1.0.0 • Published 8 years ago

test-listen-destroy v1.0.0

Weekly downloads
8
License
Apache-2.0
Repository
github
Last release
8 years ago

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