summaryrefslogtreecommitdiff
path: root/share/www/script/test
diff options
context:
space:
mode:
Diffstat (limited to 'share/www/script/test')
-rw-r--r--share/www/script/test/list_views.js31
-rw-r--r--share/www/script/test/show_documents.js13
2 files changed, 41 insertions, 3 deletions
diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js
index f9268479..67043ac8 100644
--- a/share/www/script/test/list_views.js
+++ b/share/www/script/test/list_views.js
@@ -176,6 +176,10 @@ couchTests.list_views = function(debug) {
var xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/basicBasic/basicView");
T(xhr.status == 200, "standard get should be 200");
T(/head0123456789tail/.test(xhr.responseText));
+
+ var xhr = CouchDB.request("GET", "/test_suite_db/_view/lists/basicView?list=basicBasic");
+ T(xhr.status == 200, "standard get should be 200");
+ T(/head0123456789tail/.test(xhr.responseText));
// test that etags are available
var etag = xhr.getResponseHeader("etag");
@@ -183,6 +187,12 @@ couchTests.list_views = function(debug) {
headers: {"if-none-match": etag}
});
T(xhr.status == 304);
+
+ var etag = xhr.getResponseHeader("etag");
+ xhr = CouchDB.request("GET", "/test_suite_db/_view/lists/basicView?list=basicBasic", {
+ headers: {"if-none-match": etag}
+ });
+ T(xhr.status == 304);
// test the richness of the arguments
xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/basicJSON/basicView");
@@ -208,17 +218,28 @@ couchTests.list_views = function(debug) {
T(resp.req.cookie);
// get with query params
- var xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/simpleForm/basicView?startkey=3");
+ xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/simpleForm/basicView?startkey=3");
T(xhr.status == 200, "with query params");
T(/Total Rows/.test(xhr.responseText));
T(!(/Key: 1/.test(xhr.responseText)));
T(/FirstKey: 3/.test(xhr.responseText));
T(/LastKey: 9/.test(xhr.responseText));
-
+
+ var xhr = CouchDB.request("GET", "/test_suite_db/_view/lists/basicView?list=simpleForm&startkey=3");
+ T(xhr.status == 200, "with query params");
+ T(/Total Rows/.test(xhr.responseText));
+ T(!(/Key: 1/.test(xhr.responseText)));
+ T(/FirstKey: 3/.test(xhr.responseText));
+ T(/LastKey: 9/.test(xhr.responseText));
+
// with 0 rows
var xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/simpleForm/basicView?startkey=30");
T(xhr.status == 200, "0 rows");
T(/Total Rows/.test(xhr.responseText));
+
+ var xhr = CouchDB.request("GET", "/test_suite_db/_view/lists/basicView?list=simpleForm&startkey=30");
+ T(xhr.status == 200, "0 rows");
+ T(/Total Rows/.test(xhr.responseText));
//too many Get Rows
var xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/tooManyGetRows/basicView");
@@ -231,6 +252,12 @@ couchTests.list_views = function(debug) {
T(xhr.status == 200, "reduce 0 rows");
T(/Total Rows/.test(xhr.responseText));
T(/LastKey: undefined/.test(xhr.responseText));
+
+ // reduce with 0 rows
+ var xhr = CouchDB.request("GET", "/test_suite_db/_view/lists/withReduce?list=simpleForm&startkey=30");
+ T(xhr.status == 200, "reduce 0 rows");
+ T(/Total Rows/.test(xhr.responseText));
+ T(/LastKey: undefined/.test(xhr.responseText));
// when there is a reduce present, but not used
var xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/simpleForm/withReduce?reduce=false");
diff --git a/share/www/script/test/show_documents.js b/share/www/script/test/show_documents.js
index 7201ae81..6f41f6e8 100644
--- a/share/www/script/test/show_documents.js
+++ b/share/www/script/test/show_documents.js
@@ -147,6 +147,14 @@ couchTests.show_documents = function(debug) {
// Fix for COUCHDB-379
T(equals(xhr.getResponseHeader("Server").substr(0,7), "CouchDB"));
+
+
+ xhr = CouchDB.request("GET", "/test_suite_db/"+docid+"?show=template/hello");
+ T(xhr.responseText == "Hello World");
+ T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")))
+
+ // Fix for COUCHDB-379
+ T(equals(xhr.getResponseHeader("Server").substr(0,7), "CouchDB"));
// // error stacktraces
// xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/render-error/"+docid);
@@ -163,7 +171,10 @@ couchTests.show_documents = function(debug) {
// show with doc
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/just-name/"+docid);
T(xhr.responseText == "Just Rusty");
-
+
+ xhr = CouchDB.request("GET", "/test_suite_db/"+docid+"?show=template/just-name");
+ T(xhr.responseText == "Just Rusty");
+
// show with missing doc
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/just-name/missingdoc");