Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (36 sloc) 1.257 kb
CouchCover
==========
A mock environment for using Node.js to test CouchDB design document functions.
Usage
=====
# Forgive the Coffee-colored syntax...
CouchCover = require 'CouchCover'
assert = require 'assert'
# Let's load up the design doc!
ddoc = new CouchCover.DesignDoc {
foo: '''
function(s) {
return "From foo: " + s "!";
}
'''
}
# Now, let's call function 'foo' with argument 'bar':
retVal = ddoc.call 'foo', ['bar']
# And note the return value
assert.equal 'From foo: bar!', retVal
# You can also get a reference, and call that:
fooFun = ddoc.compile 'foo'
retVal = fooFun.call 'bar'
# And note the return value
assert.equal 'From foo: bar!', retVal
Dependencies
============
There are currently no run-time dependencies, but you do need CoffeeScript to hack this package.
TODOs
=====
* Show usage of require() and log() functions from ddoc code
* CouchFunction subtypes for List, Show, Validation and Filter functions
* API documentation
* Ensure that show, list, update and validation functions cannot call
require() with a relative path
* Ensure that view map/reduce functions cannot call require whatsoever
Jump to Line
Something went wrong with that request. Please try again.