summaryrefslogtreecommitdiff
path: root/share/www/script/test/rewrite.js
diff options
context:
space:
mode:
Diffstat (limited to 'share/www/script/test/rewrite.js')
-rw-r--r--share/www/script/test/rewrite.js25
1 files changed, 23 insertions, 2 deletions
diff --git a/share/www/script/test/rewrite.js b/share/www/script/test/rewrite.js
index 86905f8f..bb188773 100644
--- a/share/www/script/test/rewrite.js
+++ b/share/www/script/test/rewrite.js
@@ -119,6 +119,10 @@ couchTests.rewrite = function(debug) {
"query": {
"startkey": ":start",
"endkey": ":end"
+ },
+ "formats": {
+ "start": "int",
+ "end": "int"
}
},
{
@@ -164,6 +168,18 @@ couchTests.rewrite = function(debug) {
}
},
{
+ "from": "simpleForm/complexView7/:a/:b",
+ "to": "_view/complexView3",
+ "query": {
+ "key": [":a", ":b"],
+ "include_docs": ":doc"
+ },
+ "format": {
+ "doc": "bool"
+ }
+
+ },
+ {
"from": "/",
"to": "_view/basicView",
}
@@ -348,14 +364,14 @@ couchTests.rewrite = function(debug) {
T(!(/Key: 1/.test(xhr.responseText)));
T(/FirstKey: 3/.test(xhr.responseText));
T(/LastKey: 8/.test(xhr.responseText));
-
+
// get with query params
xhr = CouchDB.request("GET", "/test_suite_db/_design/test/_rewrite/simpleForm/basicViewPath/3/8");
T(xhr.status == 200, "with query params");
T(!(/Key: 1/.test(xhr.responseText)));
T(/FirstKey: 3/.test(xhr.responseText));
T(/LastKey: 8/.test(xhr.responseText));
-
+
// get with query params
xhr = CouchDB.request("GET", "/test_suite_db/_design/test/_rewrite/simpleForm/complexView");
T(xhr.status == 200, "with query params");
@@ -380,6 +396,11 @@ couchTests.rewrite = function(debug) {
xhr = CouchDB.request("GET", "/test_suite_db/_design/test/_rewrite/simpleForm/complexView6?a=test&b=essai");
T(xhr.status == 200, "with query params");
T(/Value: doc 4/.test(xhr.responseText));
+
+ xhr = CouchDB.request("GET", "/test_suite_db/_design/test/_rewrite/simpleForm/complexView7/test/essai?doc=true");
+ T(xhr.status == 200, "with query params");
+ var result = JSON.parse(xhr.responseText);
+ T(typeof(result.rows[0].doc) === "object");
// test path relative to server
designDoc.rewrites.push({