attendant
v1.0.1
Published
A small-ish test server built with koa
Downloads
2
Readme
attendant
A super tiny test server. Best used to test your frontend packages.
Installation
$ npm i --save attendant
Overview
/**
* Initialize the server and set
* the response body.
*/
var attendant = require('attendant');
var request = require('supertest');
var server = attendant({foo: 'bar'});
/**
* Run tests.
*/
request(server.listen())
.get('/')
.expect('Content-Type', /json/)
.expect(200, done);
API
attendant()
// Initialize the server. Takes
// an {Object} body as an argument
// to send back as a response.
var attendant = require('attendant');
var request = require('supertest');
var server = attendant({tobi: 'ferret'});
request(server.listen())
.get('/')
.expect('Content-Type', /json/)
.expect(200, done);
request(server.listen())
.put('/')
.send({cat: 'dog'})
.expect(204, done);