This is an automated email from the ASF dual-hosted git repository. glynnbird pushed a commit to branch issue148 in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git
commit c5c9a002355ca394dbfb4c1cb47f4cd5bd5c28f8 Author: Glynn Bird <[email protected]> AuthorDate: Fri Mar 15 09:46:50 2019 +0000 added tests --- package.json | 1 + tests/helpers/unit.js | 3 +++ tests/intercept/design/search.js | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/package.json b/package.json index 27cb9d1..786d31a 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "tape": "^4.6.2" }, "scripts": { + "standard": "standard --fix", "test": "standard && npm run mocha", "mocha": "NOCK_OFF=true istanbul cover tape tests/*/*/*.js", "unmocked": "NOCK_OFF=true tape tests/*/*/*.js", diff --git a/tests/helpers/unit.js b/tests/helpers/unit.js index d5ab53f..4114fd0 100644 --- a/tests/helpers/unit.js +++ b/tests/helpers/unit.js @@ -94,6 +94,9 @@ helpers.unit = function (method, error) { delete req.httpAgent // ignore 'httpAgent' in deep equal assert } + // ignore qsStringifyOptions in object comparison + delete req.qsStringifyOptions + assert.deepEqual(req, stub) assert.end() }) diff --git a/tests/intercept/design/search.js b/tests/intercept/design/search.js index 535fae7..6079903 100644 --- a/tests/intercept/design/search.js +++ b/tests/intercept/design/search.js @@ -99,6 +99,21 @@ it('should not encode string drilldown parameter', function (assert) { }) }) +it('should encode array of arrays drilldown parameter', function (assert) { + const p = db.search('fake', 'fake', { drilldown: [['colour', 'red'], ['category', 'cake']] }) + assert.ok(helpers.isPromise(p), 'returns Promise') + p.then(function (data) { + assert.ok(true, 'Promise is resolved') + assert.equal(data.method, 'GET') + assert.equal(typeof data.headers, 'object') + console.log(data.headers) + assert.equal(typeof data.qs, 'object') + assert.end() + }).catch(function () { + assert.ok(true, 'Promise is rejected') + }) +}) + it('should encode array group_sort parameter', function (assert) { const p = db.search('fake', 'fake', { group_sort: ['-foo<number>', 'bar<string>'] })
