Skip to content

Commit

Permalink
pouchdb#6230 Fix failing websql node test callback
Browse files Browse the repository at this point in the history
  • Loading branch information
dharders committed Nov 12, 2017
1 parent cc40d38 commit a804d5c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions tests/integration/test.all_docs.js
Expand Up @@ -765,13 +765,13 @@ adapters.forEach(function (adapter) {
});


it('#6230 Test allDocs opts update_seq: true', function () {
it('#6230 Test allDocs opts update_seq: true', function (done) {
var db = new PouchDB(dbs.name);
testUtils.isPouchDbServer(function (isPouchDbServer) {
if (isPouchDbServer) {
// pouchdb-server does not currently support opts.update_seq
return;
return done();
}
var db = new PouchDB(dbs.name);
return db.bulkDocs(origDocs).then(function () {
return db.allDocs({
update_seq: true
Expand All @@ -788,7 +788,7 @@ adapters.forEach(function (adapter) {
});
var normSeq = normalizeSeq(result.update_seq);
normSeq.should.be.a('number');
});
}).then(done, done);

function normalizeSeq(seq) {
try {
Expand Down
40 changes: 20 additions & 20 deletions tests/mapreduce/test.mapreduce.js
Expand Up @@ -3763,39 +3763,39 @@ function tests(suiteName, dbName, dbType, viewType) {
});


it('#6230 Test db.query() opts update_seq: true', function () {
it('#6230 Test db.query() opts update_seq: true', function (done) {
var db = new PouchDB(dbName);
testUtils.isPouchDbServer(function (isPouchDbServer) {
if (isPouchDbServer) {
// pouchdb-server does not currently support opts.update_seq
return;
return done();
}
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"
return db.bulkDocs({ docs: docs }).then(function () {
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: 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');
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 {
Expand Down

0 comments on commit a804d5c

Please sign in to comment.