From 544bf49c09760e46507f71979f910f1ae81e2935 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Fri, 20 Aug 2010 11:26:28 +0000 Subject: Allow the replication.js test to be run outside a browser environment. Closes COUCHDB-862. Thanks Bob Dionne. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@987457 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/replication.js | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/share/www/script/test/replication.js b/share/www/script/test/replication.js index d3f41405..b92c3fcd 100644 --- a/share/www/script/test/replication.js +++ b/share/www/script/test/replication.js @@ -399,24 +399,25 @@ couchTests.replication = function(debug) { var valid_doc_ids = []; var invalid_doc_ids = []; - $.each(doc_ids, function(index, id) { - var found = false; + for (var p = 0; p < doc_ids.length; p++) { + var id = doc_ids[p]; + var found = false; - for (var k = 0; k < all_docs.length; k++) { - var doc = all_docs[k]; + for (var k = 0; k < all_docs.length; k++) { + var doc = all_docs[k]; - if (id === doc._id) { - found = true; - break; - } - } + if (id === doc._id) { + found = true; + break; + } + } - if (found) { - valid_doc_ids.push(id); - } else { - invalid_doc_ids.push(id); - } - }); + if (found) { + valid_doc_ids.push(id); + } else { + invalid_doc_ids.push(id); + } + }; dbB.deleteDb(); dbB.createDb(); @@ -434,7 +435,7 @@ couchTests.replication = function(debug) { var doc = all_docs[k]; var tgt_doc = dbB.open(doc._id); - if ($.inArray(doc._id, doc_ids) >= 0) { + if (doc_ids.indexOf(doc._id) >= 0) { T(tgt_doc !== null); T(tgt_doc.value === doc.value); } else { @@ -506,7 +507,7 @@ couchTests.replication = function(debug) { }); T(repResult.ok); - T($.isArray(repResult.history)); + T(repResult.history instanceof Array); T(repResult.history.length === 1); T(repResult.history[0].docs_written === 2); T(repResult.history[0].docs_read === 2); -- cgit v1.2.3