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 19, 2017
1 parent 037c8a6 commit 4173b45
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions tests/mapreduce/test.mapreduce.js
Expand Up @@ -3857,35 +3857,34 @@ function tests(suiteName, dbName, dbType, viewType) {
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 4173b45

Please sign in to comment.