Skip to content

single interface wrapper around koa-compose and co, to test koa middleware(s)

License

Notifications You must be signed in to change notification settings

renegare/koa-test-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-test-stack

single interface wrapper around koa-compose and co, to test koa middleware(s)

:badges:

js-standard-style

Build Status

npm version

Usage

import test from 'ava'
import sinon from 'sinon'
import {expect} from 'chai'
import co from '.'

test('should pass using an async func', async () => {
  var ctx = {}
  var stub = sinon.stub().returns('pong!')

  await co(function * ping () {
    this.body = stub()
  }, ctx)

  expect(ctx.body).to.equal('pong!')
  expect(stub.calledOnce).to.be.true
})

For a less* futuristic way of testing ... see spec.js

* using generator function to wrap your tests.

About

single interface wrapper around koa-compose and co, to test koa middleware(s)

Resources

License

Stars

Watchers

Forks

Packages

No packages published