Skip to content

Instantly share code, notes, and snippets.

@NickHeiner
Created April 14, 2015 22:41
Show Gist options
  • Save NickHeiner/a5048897ebe077d02ace to your computer and use it in GitHub Desktop.
Save NickHeiner/a5048897ebe077d02ace to your computer and use it in GitHub Desktop.
// BAD APPROACH
const heartbeat = require('./heartbeat'),
coTape = require('co-tape'),
tape = require('tape');
tape('heartbeat', function(t) {
t.test('serves heartbeat request', coTape(function*(t) {
t.plan(1);
// add some knowledge of implementation details of what we're testing
let koaContext = {
path: '/heartbeat'
},
next = function(cb) { cb(); };
yield heartbeat.apply(koaContext, next);
t.equal(koaContext.body, 'OK', 'returns the correct response');
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment