diff --git a/tests/integration/test.bulk_docs.js b/tests/integration/test.bulk_docs.js index 1732d2c283..8f0841194a 100644 --- a/tests/integration/test.bulk_docs.js +++ b/tests/integration/test.bulk_docs.js @@ -1005,6 +1005,11 @@ adapters.forEach(function (adapter) { var db = new PouchDB(dbs.name, {revs_limit: 2}); + // old revisions are always deleted with auto compaction + if (db.auto_compaction) { + return done(); + } + var revs = []; db.put({v: 1}, 'doc').then(function (v1) { revs.push(v1.rev); @@ -1016,6 +1021,8 @@ adapters.forEach(function (adapter) { // the v2 revision is still in the db return db.get('doc', {rev: revs[1]}); }).then(function (v2) { + v2.v.should.equal(2); + return db.get('doc', {rev: revs[0]}).then(function (v1) { // the v1 revision is not in the db anymore done(new Error('v1 should be missing')); diff --git a/tests/unit/test.merge.js b/tests/unit/test.merge.js index 80df9fc569..0146a5fefc 100644 --- a/tests/unit/test.merge.js +++ b/tests/unit/test.merge.js @@ -75,6 +75,7 @@ describe('test.merge.js', function () { it('Merging a path into an empty tree is the path', function () { merge([], simple, 10).should.deep.equal({ tree: [simple], + stemmedRevs: [], conflicts: 'new_leaf' }); }); @@ -82,6 +83,7 @@ describe('test.merge.js', function () { it('Remerge path into path is reflexive', function () { merge([simple], simple, 10).should.deep.equal({ tree: [simple], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -89,6 +91,7 @@ describe('test.merge.js', function () { it('Merging a path with multiple entries is the path', function () { merge([], two0, 10).should.deep.equal({ tree: [two0], + stemmedRevs: [], conflicts: 'new_leaf' }); }); @@ -96,6 +99,7 @@ describe('test.merge.js', function () { it('Merging a path with multiple entries is reflexive', function () { merge([two0], two0, 10).should.deep.equal({ tree: [two0], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -103,6 +107,7 @@ describe('test.merge.js', function () { it('Merging a subpath into a path results in the path', function () { merge([two0], simple, 10).should.deep.equal({ tree: [two0], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -110,6 +115,7 @@ describe('test.merge.js', function () { it('Merging a new leaf gives us a new leaf', function () { merge([two0], newleaf, 10).should.deep.equal({ tree: [withnewleaf], + stemmedRevs: [], conflicts: 'new_leaf' }); }); @@ -117,6 +123,7 @@ describe('test.merge.js', function () { it('Merging a new branch returns a proper tree', function () { merge([two0], two1, 10).should.deep.equal({ tree: [newbranch], + stemmedRevs: [], conflicts: 'new_branch' }); }); @@ -124,6 +131,7 @@ describe('test.merge.js', function () { it('Order of merging does not affect the resulting tree', function () { merge([two1], two0, 10).should.deep.equal({ tree: [newbranch], + stemmedRevs: [], conflicts: 'new_branch' }); }); @@ -132,6 +140,7 @@ describe('test.merge.js', function () { function () { merge([newbranch], newleaf, 10).should.deep.equal({ tree: [newbranchleaf], + stemmedRevs: [], conflicts: 'new_leaf' }); }); @@ -139,6 +148,7 @@ describe('test.merge.js', function () { it('Merging a deep branch with branches works', function () { merge([newbranchleaf], newdeepbranch, 10).should.deep.equal({ tree: [newbranchleafbranch], + stemmedRevs: [], conflicts: 'new_branch' }); }); @@ -146,6 +156,7 @@ describe('test.merge.js', function () { it('New information reconnects steming induced conflicts', function () { merge(stemmedconflicts, withnewleaf, 10).should.deep.equal({ tree: [withnewleaf], + stemmedRevs: [], conflicts: 'new_leaf' }); }); @@ -153,6 +164,7 @@ describe('test.merge.js', function () { it('Simple stemming works', function () { merge([two0], newleaf, 2).should.deep.equal({ tree: [newleaf], + stemmedRevs: ['1-1'], conflicts: 'new_leaf' }); }); @@ -160,6 +172,7 @@ describe('test.merge.js', function () { it('Merge with stemming works correctly for branches', function () { merge([newbranchleafbranch], simple, 2).should.deep.equal({ tree: stemmed2, + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -167,6 +180,7 @@ describe('test.merge.js', function () { it('Merge with stemming to leaves works fine', function () { merge([newbranchleafbranch], simple, 1).should.deep.equal({ tree: stemmed3, + stemmedRevs: ['1-1', '2-2_0'], conflicts: 'internal_node' }); }); @@ -175,6 +189,7 @@ describe('test.merge.js', function () { function () { merge(stemmed3, withnewleaf, 10).should.deep.equal({ tree: partialrecover, + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -223,6 +238,7 @@ describe('test.merge.js', function () { it('The empty tree is the identity for merge.', function () { merge([], one, 10).should.deep.equal({ tree: [one], + stemmedRevs: [], conflicts: 'new_leaf' }); }); @@ -230,6 +246,7 @@ describe('test.merge.js', function () { it('Merging is reflexive', function () { merge([one], one, 10).should.deep.equal({ tree: [one], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -239,6 +256,7 @@ describe('test.merge.js', function () { it('Merging a prefix of a tree with the tree yields the tree.', function () { merge(twoSibs, one, 10).should.deep.equal({ tree: twoSibs, + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -248,6 +266,7 @@ describe('test.merge.js', function () { it('Merging a third unrelated branch leads to a conflict.', function () { merge(twoSibs, three, 10).should.deep.equal({ tree: threeSibs, + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -260,6 +279,7 @@ describe('test.merge.js', function () { it('Merging two children is still reflexive.', function () { merge([twoChild], twoChild, 10).should.deep.equal({ tree: [twoChild], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -271,6 +291,7 @@ describe('test.merge.js', function () { it('Merging a tree to itself is itself.', function () { merge([twoChildSibs], twoChildSibs, 10).should.deep.equal({ tree: [twoChildSibs], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -284,6 +305,7 @@ describe('test.merge.js', function () { it('Merging tree of uneven length at node 2.', function () { merge([twoChild], twoChildSibs, 10).should.deep.equal({ tree: [twoChildPlusSibs], + stemmedRevs: [], conflicts: 'new_branch' }); }); @@ -292,6 +314,7 @@ describe('test.merge.js', function () { it('Merging a tree with a stem.', function () { merge([twoChildSibs], stemmed1b, 10).should.deep.equal({ tree: [twoChildSibs], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -306,6 +329,7 @@ describe('test.merge.js', function () { it('Merging a stem at a deeper level.', function () { merge([twoChildPlusSibs2], stemmed1bb, 10).should.deep.equal({ tree: [twoChildPlusSibs2], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -318,6 +342,7 @@ describe('test.merge.js', function () { function () { merge(stemmedTwoChildSibs2, stemmed1bb, 10).should.deep.equal({ tree: stemmedTwoChildSibs2, + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -326,6 +351,7 @@ describe('test.merge.js', function () { it("Merging a single tree with a deeper stem.", function () { merge([twoChild], stemmed1aa, 10).should.deep.equal({ tree: [twoChild], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -334,6 +360,7 @@ describe('test.merge.js', function () { it('Merging a larger stem.', function () { merge([twoChild], stemmed1a, 10).should.deep.equal({ tree: [twoChild], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -341,6 +368,7 @@ describe('test.merge.js', function () { it('More merging.', function () { merge([stemmed1a], stemmed1aa, 10).should.deep.equal({ tree: [stemmed1a], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -349,6 +377,7 @@ describe('test.merge.js', function () { it('Merging should create conflicts.', function () { merge([oneChild], stemmed1aa, 10).should.deep.equal({ tree: [oneChild, stemmed1aa], + stemmedRevs: [], conflicts: 'internal_node' }); }); @@ -356,6 +385,7 @@ describe('test.merge.js', function () { it('Merging should have no conflicts.', function () { merge([oneChild, stemmed1aa], twoChild, 10).should.deep.equal({ tree: [twoChild], + stemmedRevs: [], conflicts: 'new_leaf' }); }); @@ -379,6 +409,7 @@ describe('test.merge.js', function () { it('Merging trees with conflicts ought to behave.', function () { merge([foo], bar, 10).should.deep.equal({ tree: [fooBar], + stemmedRevs: [], conflicts: 'new_leaf' }); });