Skip to content

i5ting/superkoa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

superkoa

koa with supertest for ava or mocha

npm version Build js-standard-style

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/

About

koa with supertest for ava or mocha

Resources

License

Stars

Watchers

Forks

Packages

No packages published