Skip to content

Commit

Permalink
pouchdb#6230 Fix rebase duplicate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dharders committed Nov 21, 2017
1 parent bafa6df commit 2484e7e
Showing 1 changed file with 0 additions and 90 deletions.
90 changes: 0 additions & 90 deletions tests/mapreduce/test.mapreduce.js
Expand Up @@ -3830,95 +3830,5 @@ function tests(suiteName, dbName, dbType, viewType) {
});
});
});

it('#6230 Test db.query() opts update_seq: false', function () {
var db = new PouchDB(dbName);
var docs = [];
for (var i = 0; i < 4; i++) {
docs.push({
_id: i.toString(),
name: 'foo',
});
}
return createView(db, {
map: "function(doc){emit(doc.name);};\n"
}).then(function (queryFun) {
return db.bulkDocs({ docs: docs }).then(function () {
return db.query(queryFun, { update_seq: false });
}).then(function (result) {
result.rows.should.have.length(4);
should.not.exist(result.update_seq);
});
});
});


it('#6230 Test db.query() opts update_seq: true', function (done) {
testUtils.isPouchDbServer(function (isPouchDbServer) {
if (isPouchDbServer) {
// pouchdb-server does not currently support opts.update_seq
return done();
}
var db = new PouchDB(dbName);
var docs = [];
for (var i = 0; i < 4; i++) {
docs.push({
_id: i.toString(),
name: 'foo',
});
}
return db.bulkDocs({ docs: docs }).then(function () {
return createView(db, {
map: "function(doc){emit(doc.name);};\n"
});
}).then(function (queryFun) {
return db.query(queryFun, { update_seq: true });
}).then(function (result) {
result.rows.should.have.length(4);
should.exist(result.update_seq);
result.update_seq.should.satisfy(function (update_seq) {
if (typeof update_seq === 'number' || typeof update_seq === 'string') {
return true;
} else {
return false;
}
});
var normSeq = normalizeSeq(result.update_seq);
normSeq.should.be.a('number');
}).then(done, done);

function normalizeSeq(seq) {
try {
if (typeof seq === 'string' && seq.indexOf('-') > 0) {
return parseInt(seq.substring(0, seq.indexOf('-')));
}
return seq;
} catch (err) {
return seq;
}
}
});
});

it('#6230 Test db.query() opts with update_seq missing', function () {
var db = new PouchDB(dbName);
var docs = [];
for (var i = 0; i < 4; i++) {
docs.push({
_id: i.toString(),
name: 'foo',
});
}
return createView(db, {
map: "function(doc){emit(doc.name);};\n"
}).then(function (queryFun) {
return db.bulkDocs({ docs: docs }).then(function () {
return db.query(queryFun);
}).then(function (result) {
result.rows.should.have.length(4);
should.not.exist(result.update_seq);
});
});
});
});
}

0 comments on commit 2484e7e

Please sign in to comment.