diff options
Diffstat (limited to 'share/www/script/test/all_docs.js')
-rw-r--r-- | share/www/script/test/all_docs.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/share/www/script/test/all_docs.js b/share/www/script/test/all_docs.js index 3dd3aa53..fcec3b43 100644 --- a/share/www/script/test/all_docs.js +++ b/share/www/script/test/all_docs.js @@ -15,7 +15,7 @@ couchTests.all_docs = function(debug) { db.deleteDb(); db.createDb(); if (debug) debugger; - + // Create some more documents. // Notice the use of the ok member on the return result. T(db.save({_id:"0",a:1,b:1}).ok); @@ -32,7 +32,7 @@ couchTests.all_docs = function(debug) { for(var i=0; i < rows.length; i++) { T(rows[i].id >= "0" && rows[i].id <= "4"); } - + // Check _all_docs with descending=true var desc = db.allDocs({descending:true}); T(desc.total_rows == desc.rows.length); @@ -40,7 +40,7 @@ couchTests.all_docs = function(debug) { // Check _all_docs offset var all = db.allDocs({startkey:"2"}); T(all.offset == 2); - + // check that the docs show up in the seq view in the order they were created var all_seq = db.allDocsBySeq(); var ids = ["0","3","1","2"]; @@ -48,7 +48,7 @@ couchTests.all_docs = function(debug) { var row = all_seq.rows[i]; T(row.id == ids[i]); }; - + // it should work in reverse as well all_seq = db.allDocsBySeq({descending:true}); ids = ["2","1","3","0"]; @@ -56,13 +56,13 @@ couchTests.all_docs = function(debug) { var row = all_seq.rows[i]; T(row.id == ids[i]); }; - + // check that deletions also show up right var doc1 = db.open("1"); var deleted = db.deleteDoc(doc1); T(deleted.ok); all_seq = db.allDocsBySeq(); - + // the deletion should make doc id 1 have the last seq num T(all_seq.rows.length == 4); T(all_seq.rows[3].id == "1"); @@ -70,13 +70,13 @@ couchTests.all_docs = function(debug) { // is this a bug? // T(all_seq.rows.length == all_seq.total_rows); - + // do an update var doc2 = db.open("3"); doc2.updated = "totally"; db.save(doc2); all_seq = db.allDocsBySeq(); - + // the update should make doc id 3 have the last seq num T(all_seq.rows.length == 4); T(all_seq.rows[3].id == "3"); @@ -90,7 +90,7 @@ couchTests.all_docs = function(debug) { // and on the deleted one, no doc T(all_seq.rows[2].value.deleted); T(!all_seq.rows[2].doc); - + // test the all docs collates sanely db.save({_id: "Z", foo: "Z"}); db.save({_id: "a", foo: "a"}); |