From 3cf27c815bf0db1ed81e0acdd94b2f0d816c1585 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Thu, 18 Nov 2010 13:20:14 +0000 Subject: JavaScript tests: avoid global variable declarations. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1036447 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/basics.js | 6 +++--- share/www/script/test/cookie_auth.js | 2 +- share/www/script/test/proxyauth.js | 6 +++--- share/www/script/test/view_multi_key_design.js | 2 +- share/www/script/test/view_update_seq.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'share') diff --git a/share/www/script/test/basics.js b/share/www/script/test/basics.js index ce19565b..30c27c11 100644 --- a/share/www/script/test/basics.js +++ b/share/www/script/test/basics.js @@ -90,13 +90,13 @@ couchTests.basics = function(debug) { emit(null, doc.b); }; - results = db.query(mapFunction); + var results = db.query(mapFunction); // verify only one document found and the result value (doc.b). T(results.total_rows == 1 && results.rows[0].value == 16); // reopen document we saved earlier - existingDoc = db.open(id); + var existingDoc = db.open(id); T(existingDoc.a==1); @@ -189,7 +189,7 @@ couchTests.basics = function(debug) { T(xhr.status == 404); // Check for invalid document members - bad_docs = [ + var bad_docs = [ ["goldfish", {"_zing": 4}], ["zebrafish", {"_zoom": "hello"}], ["mudfish", {"zane": "goldfish", "_fan": "something smells delicious"}], diff --git a/share/www/script/test/cookie_auth.js b/share/www/script/test/cookie_auth.js index 8b35603c..8ad993cc 100644 --- a/share/www/script/test/cookie_auth.js +++ b/share/www/script/test/cookie_auth.js @@ -105,7 +105,7 @@ couchTests.cookie_auth = function(debug) { T(CouchDB.session().userCtx.name == 'Jason Davies'); // JSON login works - xhr = CouchDB.request("POST", "/_session", { + var xhr = CouchDB.request("POST", "/_session", { headers: {"Content-Type": "application/json"}, body: JSON.stringify({ name: 'Jason Davies', diff --git a/share/www/script/test/proxyauth.js b/share/www/script/test/proxyauth.js index 01d59192..40af0089 100644 --- a/share/www/script/test/proxyauth.js +++ b/share/www/script/test/proxyauth.js @@ -56,7 +56,7 @@ couchTests.proxyauth = function(debug) { CouchDB.logout(); - headers = { + var headers = { "X-Auth-CouchDB-UserName": "benoitc@apache.org", "X-Auth-CouchDB-Roles": "test", "X-Auth-CouchDB-Token": hex_hmac_sha1(secret, "benoitc@apache.org") @@ -78,7 +78,7 @@ couchTests.proxyauth = function(debug) { db.save(designDoc); - req = CouchDB.request("GET", "/test_suite_db/_design/test/_show/welcome", + var req = CouchDB.request("GET", "/test_suite_db/_design/test/_show/welcome", {headers: headers}); T(req.responseText == "Welcome benoitc@apache.org"); @@ -86,7 +86,7 @@ couchTests.proxyauth = function(debug) { {headers: headers}); T(req.responseText == "test"); - xhr = CouchDB.request("PUT", "/_config/couch_httpd_auth/proxy_use_secret",{ + var xhr = CouchDB.request("PUT", "/_config/couch_httpd_auth/proxy_use_secret",{ body : JSON.stringify("true"), headers: {"X-Couch-Persist": "false"} }); diff --git a/share/www/script/test/view_multi_key_design.js b/share/www/script/test/view_multi_key_design.js index b3cec657..38396955 100644 --- a/share/www/script/test/view_multi_key_design.js +++ b/share/www/script/test/view_multi_key_design.js @@ -112,7 +112,7 @@ couchTests.view_multi_key_design = function(debug) { } // Test that a map & reduce containing func support keys when reduce=false - resp = db.view("test/summate", {reduce: false}, keys); + var resp = db.view("test/summate", {reduce: false}, keys); T(resp.rows.length == 5); resp = db.view("test/summate", {reduce: false, keys: keys}, null); diff --git a/share/www/script/test/view_update_seq.js b/share/www/script/test/view_update_seq.js index c347839d..69b8c42d 100644 --- a/share/www/script/test/view_update_seq.js +++ b/share/www/script/test/view_update_seq.js @@ -18,7 +18,7 @@ couchTests.view_update_seq = function(debug) { T(db.info().update_seq == 0); - resp = db.allDocs({update_seq:true}); + var resp = db.allDocs({update_seq:true}); T(resp.rows.length == 0); T(resp.update_seq == 0); -- cgit v1.2.3