diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-08-20 11:26:28 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-08-20 11:26:28 +0000 |
commit | 544bf49c09760e46507f71979f910f1ae81e2935 (patch) | |
tree | a48014712f8f34c37fd8829a6aec6027845a9c9a /share | |
parent | 04d3501301031fde6bce119a8c9275ef9e8830d5 (diff) |
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
Diffstat (limited to 'share')
-rw-r--r-- | share/www/script/test/replication.js | 35 |
1 files 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); |