couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [couchdb] 02/02: Add tests for error on invalid `docs` attribute
Date Thu, 02 Nov 2017 14:47:33 GMT
This is an automated email from the ASF dual-hosted git repository.

eiri pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 01658a0cc889cffce0ca73b1d06525d708398af8
Author: Eric Avdey <eiri@eiri.ca>
AuthorDate: Thu Nov 2 10:54:15 2017 -0300

    Add tests for error on invalid `docs` attribute
---
 test/javascript/tests/bulk_docs.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/javascript/tests/bulk_docs.js b/test/javascript/tests/bulk_docs.js
index 9f88e81..ae8a087 100644
--- a/test/javascript/tests/bulk_docs.js
+++ b/test/javascript/tests/bulk_docs.js
@@ -110,6 +110,16 @@ couchTests.bulk_docs = function(debug) {
   T(result.error == "bad_request");
   T(result.reason == "POST body must include `docs` parameter.");
 
+  // verify that sending a request with invalid `docs` causes error
+  var req = CouchDB.request("POST", "/" + db_name + "/_bulk_docs", {
+    body: JSON.stringify({"docs": "foo"})
+  });
+
+  T(req.status == 400);
+  result = JSON.parse(req.responseText);
+  T(result.error == "bad_request");
+  T(result.reason == "`docs` parameter must be an array.");
+
   // verify that sending a request with invalid `new_edits` causes error
   var req = CouchDB.request("POST", "/" + db_name + "/_bulk_docs", {
     body: JSON.stringify({"docs": [], "new_edits": 0})

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <commits@couchdb.apache.org>.

Mime
View raw message