Skip to content

Commit

Permalink
Fixes issue when calling addDB multiple times.
Browse files Browse the repository at this point in the history
  • Loading branch information
mactroyibm committed Nov 19, 2015
1 parent c5e9eda commit dccc994
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/addDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ module.exports = function (name, arr) {

this.databases[name] = mockDB(database);
this.changes[name] = changes;
Object.defineProperty(this.sequence, name, {
get : function () {
return this.changes[name].length + 1; //couchdb sequence starts with 1
}.bind(this)
});
if (!this.sequence.hasOwnProperty(name)) {
Object.defineProperty(this.sequence, name, {
get : function () {
return this.changes[name].length + 1; //couchdb sequence starts with 1
}.bind(this)
});
}

return this.databases[name];
};
Expand Down

0 comments on commit dccc994

Please sign in to comment.