UNPKG

supertest-koa-agent

Version:

Converts a Koa app into a supertest compatible agent instance.

29 lines (22 loc) 414 B
'use strict' /*! * imports. */ var agent = require('supertest').agent var http = require('http') /*! * exports. */ module.exports = server /** * Converts a Koa app into a supertest compatible agent instance. * * @param {Application} app * Koa application instance. * * @return {TestAgent} * Supertest agent instance. */ function server (app) { return agent(http.createServer(app.callback())) }