summaryrefslogtreecommitdiff
path: root/share/www/script/test/rev_stemming.js
diff options
context:
space:
mode:
authorNoah Slater <nslater@apache.org>2009-07-06 00:33:50 +0000
committerNoah Slater <nslater@apache.org>2009-07-06 00:33:50 +0000
commit282b96ddd9a84b740788c2358ec0f5fedafb7cc6 (patch)
treefb48e605ceb8079d0195d3b1ec0eca7110fa7ef2 /share/www/script/test/rev_stemming.js
parentb5cc085d3bc6316063f14adedf20632ee904875d (diff)
trimmed trailing whitespace
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/rev_stemming.js')
-rw-r--r--share/www/script/test/rev_stemming.js36
1 files changed, 18 insertions, 18 deletions
diff --git a/share/www/script/test/rev_stemming.js b/share/www/script/test/rev_stemming.js
index 3832b520..6dc94f70 100644
--- a/share/www/script/test/rev_stemming.js
+++ b/share/www/script/test/rev_stemming.js
@@ -18,11 +18,11 @@ couchTests.rev_stemming = function(debug) {
dbB.deleteDb();
dbB.createDb();
if (debug) debugger;
-
+
var newLimit = 5;
-
+
T(db.getDbProperty("_revs_limit") == 1000);
-
+
var doc = {_id:"foo",foo:0}
for( var i=0; i < newLimit + 1; i++) {
doc.foo++;
@@ -30,30 +30,30 @@ couchTests.rev_stemming = function(debug) {
}
var doc0 = db.open("foo", {revs:true});
T(doc0._revisions.ids.length == newLimit + 1);
-
+
var docBar = {_id:"bar",foo:0}
for( var i=0; i < newLimit + 1; i++) {
docBar.foo++;
T(db.save(docBar).ok);
}
T(db.open("bar", {revs:true})._revisions.ids.length == newLimit + 1);
-
+
T(db.setDbProperty("_revs_limit", newLimit).ok);
-
+
for( var i=0; i < newLimit + 1; i++) {
doc.foo++;
T(db.save(doc).ok);
}
doc0 = db.open("foo", {revs:true});
T(doc0._revisions.ids.length == newLimit);
-
-
+
+
// If you replicate after you make more edits than the limit, you'll
// cause a spurious edit conflict.
CouchDB.replicate("test_suite_db_a", "test_suite_db_b");
var docB1 = dbB.open("foo",{conflicts:true})
T(docB1._conflicts == null);
-
+
for( var i=0; i < newLimit - 1; i++) {
doc.foo++;
T(db.save(doc).ok);
@@ -69,30 +69,30 @@ couchTests.rev_stemming = function(debug) {
doc.foo++;
T(db.save(doc).ok);
}
-
+
CouchDB.replicate("test_suite_db_a", "test_suite_db_b");
-
+
var docB2 = dbB.open("foo",{conflicts:true});
-
+
// we have a conflict, but the previous replicated rev is always the losing
// conflict
T(docB2._conflicts[0] == docB1._rev)
-
+
// We having already updated bar before setting the limit, so it's still got
// a long rev history. compact to stem the revs.
-
+
T(db.open("bar", {revs:true})._revisions.ids.length == newLimit + 1);
-
+
T(db.compact().ok);
-
+
// compaction isn't instantaneous, loop until done
while (db.info().compact_running) {};
-
+
// force reload because ETags don't honour compaction
var req = db.request("GET", "/test_suite_db_a/bar?revs=true", {
headers:{"if-none-match":"pommes"}
});
-
+
var finalDoc = JSON.parse(req.responseText);
TEquals(newLimit, finalDoc._revisions.ids.length,
"should return a truncated revision list");