This package has been deprecated

Author message:

This package is deprecated and no longer maintained.

unexpected-couchdb

2.0.1 • Public • Published

unexpected-couchdb

This unexpected plugin enables unit testing requests against a mock couchdb server.

It leverages unexpected-mitm and the mock-couch library integrating them into a neat assertion. Teh structure of the database is specified declaratively and appropriate responses generated automatically.

Example

The following example uses unexpected-http to assert the generated response is valid.

var expect = require('unexpected').clone();
 
expect.installPlugin(require('unexpected-couchdb'));
expect.installPlugin(require('unexpected-http'));
 
describe('documentation', function () {
    it('should return the contents of myDatabase including the documents', function () {
        return expect('GET /myDatabase/_all_docs?include_docs=true', 'with couchdb mocked out', {
            myDatabase: {
                docs: [
                    {
                        _id: 'myDocument',
                        foo: 'bar',
                        baz: 1
                    }
                ]
            }
        }, 'to yield response', {
            statusCode: 200,
            body: {
                total_rows: 1,
                rows: [
                    {
                        id: 'myDocument',
                        doc: {
                            _id: 'myDocument',
                            foo: 'bar',
                            baz: 1
                        }
                    }
                ]
            }
        });
    });
});

License

Licensed under a standard 3-clause BSD license -- see the LICENSE file for details.

Dependents (0)

Package Sidebar

Install

npm i unexpected-couchdb

Weekly Downloads

0

Version

2.0.1

License

BSD-3-Clause

Unpacked Size

11.9 kB

Total Files

7

Last publish

Collaborators

  • alexjeffburke