superkoa
v1.0.3
Published
koa with supertest for ava or mocha
Downloads
708
Readme
superkoa
koa with supertest for ava or mocha
Usages
import app from './app'
import superkoa from './superkoa'
test.cb("superkoa()", t => {
superkoa(app)
.get("/")
.expect(200, function (err, res) {
t.ifError(err)
var userId = res.body.id;
t.is(res.text, 'Hello Koa', 'res.text == Hello Koa')
t.end()
});
});
with generator
test('yield superkoa()', function * (t) {
let res = yield superkoa(app)
.get('/')
t.is(200, res.status)
t.is(res.text, 'Hello Koa', 'res.text == Hello Koa')
})
with async/await
test('async superkoa()', async (t) => {
let res = await superkoa(app)
.get('/')
t.is(200, res.status)
t.is(res.text, 'Hello Koa', 'res.text == Hello Koa')
})
Test
$ npm test
with watch mode
npm test -- -w
Document
see http://visionmedia.github.io/superagent/