summaryrefslogtreecommitdiff
path: root/share/www/script/test
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-03-20 10:58:52 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-03-20 10:58:52 +0000
commit0b55e8a26c9314312732f6481ae62c7a5611f072 (patch)
treec4173d9ce900ce4c67ec3b822e17064a1be15a73 /share/www/script/test
parentc87b89dea947ac11ce46f9f7d6dcf873caa990d4 (diff)
map queries with group=true query option will return an error.
closes COUCHDB-185. changes to jquery.couch.js to support ajaxOptions may be useful for more than just openDoc, will need to be spread to the rest of the API. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@756413 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test')
-rw-r--r--share/www/script/test/view_errors.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/share/www/script/test/view_errors.js b/share/www/script/test/view_errors.js
index 66fdfa69..aa698f4d 100644
--- a/share/www/script/test/view_errors.js
+++ b/share/www/script/test/view_errors.js
@@ -49,4 +49,41 @@ couchTests.view_errors = function(debug) {
})
});
T(JSON.parse(xhr.responseText).error == "invalid_json");
+
+ var map = function (doc) {emit(doc.integer, doc.integer);};
+
+ try {
+ db.query(map, null, {group: true});
+ T(0 == 1);
+ } catch(e) {
+ T(e.error == "query_parse_error");
+ }
+
+ // reduce=false on map views doesn't work, so group=true will
+ // never throw for temp reduce views.
+
+ var designDoc = {
+ _id:"_design/test",
+ language: "javascript",
+ views: {
+ no_reduce: {map:"function(doc) {emit(doc._id, null);}"},
+ with_reduce: {map:"function (doc) {emit(doc.integer, doc.integer)};",
+ reduce:"function (keys, values) { return sum(values); };"},
+ }
+ };
+ T(db.save(designDoc).ok);
+
+ try {
+ db.view("test/no_reduce", {group: true});
+ T(0 == 1);
+ } catch(e) {
+ T(e.error == "query_parse_error");
+ }
+
+ try {
+ db.view("test/with_reduce", {group: true, reduce: false});
+ T(0 == 1);
+ } catch(e) {
+ T(e.error == "query_parse_error");
+ }
};