Skip to content

fubar/mock-cloudant

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a node.js module to mock IBM Cloudant for testing based on mock-couch. See https://github.com/chris-l/mock-couch and http://chris-l.github.io/mock-couch/

In addition to mock-couch, this library provides a basic version of Cloudant's _find endpoint as well as the ability to POST single documents (in addition to POST _bulk_docs).

Installation:

npm install --save-dev fubar/mock-cloudant

Example

For convenient usage in tests, consider creating a utility class like:

'use strict';

var mockCloudant = require('mock-cloudant');
var MockCouch = mockCloudant.MockCouch; // eslint-disable-line no-unused-vars

class CloudantMock {

  /** @member {MockCouch} CloudantMock#cloudantMockServer */

  start () {
    this.cloudantMockServer = mockCloudant.createServer();
    this.cloudantMockServer.listen(1337);
    this.cloudantMockServer.addDB('users');
  }

  stop () {
    this.cloudantMockServer && this.cloudantMockServer.close();
  }
}

module.exports = CloudantMock;

About

A node.js module to mock IBM Cloudant for testing. Based on http://chris-l.github.io/mock-couch/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%