Comparing version 5.2.3 to 5.3.0
@@ -531,10 +531,19 @@ 'use strict'; | ||
this.tables[table][method] = internals.disabled; | ||
this.tables[table][method] = internals.disabled(options); | ||
}; | ||
internals.disabled = function () { | ||
internals.disabled = function (options) { | ||
const callback = arguments[arguments.length - 1]; | ||
return callback(Boom.internal('Simulated database error')); | ||
const value = options.value; | ||
return function () { | ||
const callback = arguments[arguments.length - 1]; | ||
if (value !== undefined) { | ||
return callback(null, value); | ||
} | ||
return callback(Boom.internal('Simulated database error')); | ||
}; | ||
}; | ||
@@ -541,0 +550,0 @@ |
{ | ||
"name": "penseur", | ||
"description": "Lightweight RethinkDB wrapper", | ||
"version": "5.2.3", | ||
"version": "5.3.0", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/penseur", |
@@ -889,2 +889,44 @@ 'use strict'; | ||
it('simulates a response', (done) => { | ||
const db = new Penseur.Db('penseurtest', { host: 'localhost', port: 28015, test: true }); | ||
db.establish(['test'], (err) => { | ||
expect(err).to.not.exist(); | ||
db.test.insert({ id: 1, value: 'x' }, (err, result) => { | ||
expect(err).to.not.exist(); | ||
db.test.get(1, (err, item1) => { | ||
expect(err).to.not.exist(); | ||
expect(item1.value).to.equal('x'); | ||
db.disable('test', 'get', { value: 'hello' }); | ||
db.test.get(1, (err, item2) => { | ||
expect(err).to.not.exist(); | ||
expect(item2).to.equal('hello'); | ||
db.disable('test', 'get', { value: null }); | ||
db.test.get(1, (err, item3) => { | ||
expect(err).to.not.exist(); | ||
expect(item3).to.be.null(); | ||
db.enable('test', 'get'); | ||
db.test.get(1, (err, item4) => { | ||
expect(err).to.not.exist(); | ||
expect(item4.value).to.equal('x'); | ||
db.close(done); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
it('simulates a changes error', (done) => { | ||
@@ -891,0 +933,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177977
4260