You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/02/10 09:31:50 UTC
svn commit: r1069270 -
/couchdb/branches/1.1.x/share/www/script/test/all_docs.js
Author: fdmanana
Date: Thu Feb 10 08:31:49 2011
New Revision: 1069270
URL: http://svn.apache.org/viewvc?rev=1069270&view=rev
Log:
Merged revision 1069268 from trunk
Added more tests to all_docs.js
Modified:
couchdb/branches/1.1.x/share/www/script/test/all_docs.js
Modified: couchdb/branches/1.1.x/share/www/script/test/all_docs.js
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/share/www/script/test/all_docs.js?rev=1069270&r1=1069269&r2=1069270&view=diff
==============================================================================
--- couchdb/branches/1.1.x/share/www/script/test/all_docs.js (original)
+++ couchdb/branches/1.1.x/share/www/script/test/all_docs.js Thu Feb 10 08:31:49 2011
@@ -86,10 +86,40 @@ couchTests.all_docs = function(debug) {
T(changes.results[2].doc);
T(changes.results[2].doc._deleted);
+ // add conflicts
+ var conflictDoc1 = {
+ _id: "3", _rev: "2-aa01552213fafa022e6167113ed01087", value: "X"
+ };
+ var conflictDoc2 = {
+ _id: "3", _rev: "2-ff01552213fafa022e6167113ed01087", value: "Z"
+ };
+ T(db.save(conflictDoc1, {new_edits: false}));
+ T(db.save(conflictDoc2, {new_edits: false}));
+
+ var winRev = db.open("3");
+
+ changes = db.changes({include_docs: true, style: "all_docs"});
+ TEquals("3", changes.results[3].id);
+ TEquals(3, changes.results[3].changes.length);
+ TEquals(winRev._rev, changes.results[3].changes[0].rev);
+ TEquals("3", changes.results[3].doc._id);
+ TEquals(winRev._rev, changes.results[3].doc._rev);
+
+ rows = db.allDocs({include_docs: true}).rows;
+ TEquals(3, rows.length);
+ TEquals("3", rows[2].key);
+ TEquals("3", rows[2].id);
+ TEquals(winRev._rev, rows[2].value.rev);
+ TEquals(winRev._rev, rows[2].doc._rev);
+ TEquals("3", rows[2].doc._id);
+
// test the all docs collates sanely
db.save({_id: "Z", foo: "Z"});
db.save({_id: "a", foo: "a"});
var rows = db.allDocs({startkey: "Z", endkey: "Z"}).rows;
T(rows.length == 1);
+
+ // cleanup
+ db.deleteDb();
};