summaryrefslogtreecommitdiff
path: root/share/www/script/test/show_documents.js
diff options
context:
space:
mode:
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) {