All Projects → i5ting → superkoa

i5ting / superkoa

Licence: MIT license
koa with supertest for ava or mocha

Programming Languages

javascript
184084 projects - #8 most used programming language

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/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].