Skip to content

Instantly share code, notes, and snippets.

@kilianc
Last active December 28, 2015 15:38
Show Gist options
  • Save kilianc/7522780 to your computer and use it in GitHub Desktop.
Save kilianc/7522780 to your computer and use it in GitHub Desktop.
Testing if I forgot to make each method continuable. I am afraid I may be going insane.
describe('#*', function () {
it('should return a continuable if a callback is not passed', function () {
Object.keys(Db.prototype).forEach(function (functionName) {
var params = introspect(db[functionName])
if (params.pop() === 'callback') {
var fnStr = db[functionName].toString()
var line = f('if (undefined === callback) return this.%s.bind(this, %s)', functionName, params.join(', '))
assert.isFunction(db[functionName](), functionName)
assert.ok(~fnStr.indexOf(line), functionName)
}
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment