Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

penseur

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

penseur - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

32

lib/db.js

@@ -23,2 +23,9 @@ // Load Modules

if (this._settings.test) {
this.disable = internals.disable;
this.enable = internals.enable;
}
delete this._settings.test; // Always delete in case value is falsy
this.tables = {};

@@ -177,1 +184,26 @@ };

};
internals.disable = function (table, method) {
Hoek.assert(this.tables[table], 'Unknown table:', table);
Hoek.assert(this.tables[table][method], 'Unknown method:', method);
this.tables[table][method] = internals.disabled;
};
internals.disabled = function () {
var callback = arguments[arguments.length - 1];
return callback(new Error('Simulated database error'));
};
internals.enable = function (table, method) {
Hoek.assert(this.tables[table], 'Unknown table:', table);
Hoek.assert(this.tables[table][method], 'Unknown method:', method);
this.tables[table][method] = Table.prototype[method];
};

4

package.json
{
"name": "penseur",
"description": "Lightweight RethinkDB wrapper",
"version": "1.4.1",
"version": "1.5.0",
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)",

@@ -12,3 +12,3 @@ "repository": "git://github.com/hueniverse/penseur",

"engines": {
"node": ">=0.10.40"
"node": "4.x.x"
},

@@ -15,0 +15,0 @@ "dependencies": {

@@ -229,2 +229,39 @@ // Load modules

});
describe('disable()', function () {
it('simulates an error', function (done) {
var db = new Penseur.Db('penseurtest', { host: 'localhost', port: 28015, test: true });
db.establish(['test'], function (err) {
expect(err).to.not.exist();
db.test.insert({ id: 1, value: 'x' }, function (err, result) {
expect(err).to.not.exist();
db.test.get(1, function (err, item1) {
expect(err).to.not.exist();
expect(item1.value).to.equal('x');
db.disable('test', 'get');
db.test.get(1, function (err, item2) {
expect(err).to.exist();
db.enable('test', 'get');
db.test.get(1, function (err, item3) {
expect(err).to.not.exist();
expect(item3.value).to.equal('x');
db.close(done);
});
});
});
});
});
});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc