diff options
Diffstat (limited to 'share/www/script/test/basics.js')
-rw-r--r-- | share/www/script/test/basics.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/share/www/script/test/basics.js b/share/www/script/test/basics.js index 5e26360f..3979d860 100644 --- a/share/www/script/test/basics.js +++ b/share/www/script/test/basics.js @@ -29,15 +29,19 @@ couchTests.basics = function(debug) { if (debug) debugger; // creating a new DB should return Location header - xhr = CouchDB.request("DELETE", "/test_suite_db"); - xhr = CouchDB.request("PUT", "/test_suite_db"); - TEquals("/test_suite_db", - xhr.getResponseHeader("Location").substr(-14), - "should return Location header to newly created document"); - - TEquals("http://", - xhr.getResponseHeader("Location").substr(0, 7), - "should return absolute Location header to newly created document"); + // and it should work for dbs with slashes (COUCHDB-411) + var dbnames = ["test_suite_db", "test_suite_db%2Fwith_slashes"]; + dbnames.forEach(function(dbname) { + xhr = CouchDB.request("DELETE", "/" + dbname); + xhr = CouchDB.request("PUT", "/" + dbname); + TEquals(dbname, + xhr.getResponseHeader("Location").substr(-dbname.length), + "should return Location header to newly created document"); + + TEquals("http://", + xhr.getResponseHeader("Location").substr(0, 7), + "should return absolute Location header to newly created document"); + }); // Get the database info, check the db_name T(db.info().db_name == "test_suite_db"); |