Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

unexpected-couchdb

alexjeffburke15BSD-3-Clausedeprecated2.0.1

This package is deprecated and no longer maintained.

Unexpected plugin for unit testing against a mock couchdb server.

readme

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.