Run CouchDB show, list and update functions in a fake environment for testing purposes
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
couch-fakerequest.js
kanso.json

README.md

Couch FakeRequest

Utilities for calling show, list and update functions using test data. Creates a test environment with the global functions expected by the CouchDB JS view server.

API

show(showfn, doc, req)

Run show function. The response will always be converted to an object, if a string is returned the object will be {body: }

  • showfn - Function - the show function to call
  • doc - Object - the JSON doc to pass to the show function
  • req - Object - the request object to pass to the show function

list(listfn, viewdata, req)

Run list function. Converts the JSON returned from a view into a head object to pass to the list function and hooks up the global getRow function to shift values off the rows property.

  • listfn - Function - the list function to call
  • viewdata - Object - data returned by the view to use
  • req - Object - the request object to pass to the list function

update(updatefn, doc, req)

Run update function. The response (second item in the returned array) will always be converted to an object, if a string is returned the object will be {body: }.

  • updatefn - Function - the update function to call
  • doc - Object - the JSON doc to pass to the update function
  • req - Object - the request object to pass to the update function