summaryrefslogtreecommitdiff
path: root/share/www/script/test/show_documents.js
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-12-22 18:03:44 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-12-22 18:03:44 +0000
commitea3b1153e52ac1513da4d634eedefb05c261039c (patch)
tree858c5b3d81509bfe784b8d2d1252921cbf34aa54 /share/www/script/test/show_documents.js
parent22c551bb103072826c0299265670d1483c753dde (diff)
move query server to a design-doc based protocol, closes COUCHDB-589
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@893249 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/show_documents.js')
-rw-r--r--share/www/script/test/show_documents.js25
1 files changed, 12 insertions, 13 deletions
diff --git a/share/www/script/test/show_documents.js b/share/www/script/test/show_documents.js
index ae4368a8..53ffbc42 100644
--- a/share/www/script/test/show_documents.js
+++ b/share/www/script/test/show_documents.js
@@ -21,14 +21,11 @@ couchTests.show_documents = function(debug) {
language: "javascript",
shows: {
"hello" : stringFun(function(doc, req) {
+ log("hello fun");
if (doc) {
return "Hello World";
} else {
- if(req.docId) {
- return "New World";
- } else {
- return "Empty World";
- }
+ return "Empty World";
}
}),
"just-name" : stringFun(function(doc, req) {
@@ -140,7 +137,7 @@ couchTests.show_documents = function(debug) {
// hello template world
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/hello/"+docid);
- T(xhr.responseText == "Hello World");
+ T(xhr.responseText == "Hello World", "hello");
T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")))
// Fix for COUCHDB-379
@@ -168,8 +165,10 @@ couchTests.show_documents = function(debug) {
// // hello template world (non-existing docid)
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/hello/nonExistingDoc");
- T(xhr.responseText == "New World");
-
+ T(xhr.status == 404);
+ var resp = JSON.parse(xhr.responseText);
+ T(resp.error == "not_found");
+
// show with doc
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/just-name/"+docid);
T(xhr.responseText == "Just Rusty");
@@ -179,9 +178,9 @@ couchTests.show_documents = function(debug) {
// show with missing doc
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/just-name/missingdoc");
-
- T(xhr.status == 404, 'Doc should be missing');
- T(xhr.responseText == "No such doc");
+ T(xhr.status == 404);
+ var resp = JSON.parse(xhr.responseText);
+ T(resp.error == "not_found");
// show with missing func
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/missing/"+docid);
@@ -268,8 +267,8 @@ couchTests.show_documents = function(debug) {
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/just-name/"+docid, {
headers: {"if-none-match": etag}
});
- // should be 304
- T(xhr.status == 304);
+ // should not be 304 if we change the doc
+ T(xhr.status != 304, "changed ddoc");
// update design doc function
designDoc.shows["just-name"] = (function(doc, req) {