From e8fc96d779c26311f37f362416eb27874b8d2155 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Tue, 19 Oct 2010 19:50:54 +0000 Subject: Added missing semi-colons and variable declarations . git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1024378 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/changes.js | 50 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'share/www/script') diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js index b1404ba0..bfb129f7 100644 --- a/share/www/script/test/changes.js +++ b/share/www/script/test/changes.js @@ -12,7 +12,7 @@ function jsonp(obj) { T(jsonp_flag == 0); - T(obj.results.length == 1 && obj.last_seq==1, "jsonp") + T(obj.results.length == 1 && obj.last_seq == 1, "jsonp"); jsonp_flag = 1; } @@ -25,7 +25,7 @@ couchTests.changes = function(debug) { var req = CouchDB.request("GET", "/test_suite_db/_changes"); var resp = JSON.parse(req.responseText); - T(resp.results.length == 0 && resp.last_seq==0, "empty db") + T(resp.results.length == 0 && resp.last_seq == 0, "empty db"); var docFoo = {_id:"foo", bar:1}; T(db.save(docFoo).ok); T(db.ensureFullCommit().ok); @@ -35,8 +35,8 @@ couchTests.changes = function(debug) { var resp = JSON.parse(req.responseText); T(resp.last_seq == 1); - T(resp.results.length == 1, "one doc db") - T(resp.results[0].changes[0].rev == docFoo._rev) + T(resp.results.length == 1, "one doc db"); + T(resp.results[0].changes[0].rev == docFoo._rev); // test with callback @@ -90,16 +90,16 @@ couchTests.changes = function(debug) { change1 = JSON.parse(lines[0]); change2 = JSON.parse(lines[1]); if (change2.seq != 2) { - throw "bad seq, try again" + throw "bad seq, try again"; } }, "bar-only"); - T(change1.seq == 1) - T(change1.id == "foo") + T(change1.seq == 1); + T(change1.id == "foo"); - T(change2.seq == 2) - T(change2.id == "bar") - T(change2.changes[0].rev == docBar._rev) + T(change2.seq == 2); + T(change2.id == "bar"); + T(change2.changes[0].rev == docBar._rev); var docBaz = {_id:"baz", baz:1}; @@ -110,7 +110,7 @@ couchTests.changes = function(debug) { lines = xhr.responseText.split("\n"); change3 = JSON.parse(lines[2]); if (change3.seq != 3) { - throw "bad seq, try again" + throw "bad seq, try again"; } }); @@ -133,8 +133,8 @@ couchTests.changes = function(debug) { } }, "heartbeat"); - T(str.charAt(str.length - 1) == "\n") - T(str.charAt(str.length - 2) == "\n") + T(str.charAt(str.length - 1) == "\n"); + T(str.charAt(str.length - 2) == "\n"); // otherwise we'll continue to receive heartbeats forever xhr.abort(); @@ -164,10 +164,10 @@ couchTests.changes = function(debug) { if (line.charAt(line.length-1) == ",") { var linetrimmed = line.substring(0, line.length-1); } else { - var linetrimmed = line + var linetrimmed = line; } return JSON.parse(linetrimmed); - } + }; waitForSuccess(function() { lines = xhr.responseText.split("\n"); @@ -197,7 +197,7 @@ couchTests.changes = function(debug) { "userCtx" : stringFun(function(doc, req) { return doc.user && (doc.user == req.userCtx.name); }), - "conflicted" : "function(doc, req) { return (doc._conflicts);}", + "conflicted" : "function(doc, req) { return (doc._conflicts);}" }, options : { local_seq : true @@ -207,7 +207,7 @@ couchTests.changes = function(debug) { map : "function(doc) {emit(doc._local_seq, null)}" } } - } + }; db.save(ddoc); @@ -253,8 +253,8 @@ couchTests.changes = function(debug) { T(resp.results && resp.results.length > 0 && resp.results[0]["id"] == "bingo", "filter the correct update"); xhr.abort(); - timeout = 500; - last_seq = 10 + var timeout = 500; + var last_seq = 10; while (true) { // filter with continuous @@ -269,15 +269,15 @@ couchTests.changes = function(debug) { waitForSuccess(function() { // throws an error after 5 seconds if (xhr.readyState != 4) { - throw("still waiting") + throw("still waiting"); } }, "continuous-rusty"); lines = xhr.responseText.split("\n"); + var good = false; try { - JSON.parse(lines[3]) + JSON.parse(lines[3]); good = true; } catch(e) { - good = false; } if (good) { T(JSON.parse(lines[1]).id == "bingo", lines[1]); @@ -352,7 +352,7 @@ couchTests.changes = function(debug) { req = CouchDB.request("GET", "/test_suite_db/_changes?limit=1"); resp = JSON.parse(req.responseText); - TEquals(1, resp.results.length) + TEquals(1, resp.results.length); //filter includes _conflicts var id = db.save({'food' : 'pizza'}).id; @@ -402,7 +402,7 @@ couchTests.changes = function(debug) { // test filtering on docids // - options = { + var options = { headers: {"Content-Type": "application/json"}, body: JSON.stringify({"doc_ids": ["something", "anotherthing", "andmore"]}) }; @@ -443,7 +443,7 @@ couchTests.changes = function(debug) { console.log(xhr.readyState); }, "andmore-only"); - line = JSON.parse(xhr.responseText.split("\n")[0]); + var line = JSON.parse(xhr.responseText.split("\n")[0]); console.log(line); T(line.seq == 8); T(line.id == "andmore"); -- cgit v1.2.3