From 4b900a07dd82c94d87f873cf0b2a7e0a77cbf7b1 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Fri, 28 Aug 2009 01:10:42 +0000 Subject: guard against non-existing filters in _changes git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@808716 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/changes.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'share/www/script/test') diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js index 1adfaa1b..314a52b5 100644 --- a/share/www/script/test/changes.js +++ b/share/www/script/test/changes.js @@ -188,7 +188,25 @@ couchTests.changes = function(debug) { req = CouchDB.request("GET", "/test_suite_db/_changes?filter=changes_filter/dynamic&field=bop"); resp = JSON.parse(req.responseText); T(resp.results.length == 1); - + + // error conditions + + // non-existing design doc + var req = CouchDB.request("GET", + "/test_suite_db/_changes?filter=nothingtosee/bop"); + TEquals(400, req.status, "should return 400 for non existant design doc"); + + // non-existing filter + var req = CouchDB.request("GET", + "/test_suite_db/_changes?filter=changes_filter/movealong"); + TEquals(400, req.status, "should return 400 for non existant filter fun"); + + // both + var req = CouchDB.request("GET", + "/test_suite_db/_changes?filter=nothingtosee/movealong"); + TEquals(400, req.status, + "should return 400 for non existant design doc and filter fun"); + // changes get all_docs style with deleted docs var doc = {a:1}; db.save(doc); -- cgit v1.2.3