From ea3b1153e52ac1513da4d634eedefb05c261039c Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Tue, 22 Dec 2009 18:03:44 +0000 Subject: 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 --- share/www/script/test/show_documents.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'share/www/script/test/show_documents.js') 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) { -- cgit v1.2.3