New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

percy

Package Overview
Dependencies
Maintainers
3
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

percy - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

package.json
{
"name": "percy",
"version": "2.0.1",
"version": "2.0.2",
"description": "A persistance layer that plays nice with Couchbase",

@@ -5,0 +5,0 @@ "main": "percy.js",

@@ -1,7 +0,4 @@

var kgo = require('kgo'),
arrayProto = [];
var kgo = require('kgo');
function get(id, callback) {
var percy = this;
kgo

@@ -59,3 +56,3 @@ ('bucket', this.connector)

(['entityKey', 'bucket', 'model'], function(entityKey, bucket, model){
bucket.set(entityKey, model, function(error, result){
bucket.set(entityKey, model, function(error){
if(error){

@@ -80,3 +77,3 @@ return callback(error);

(['entityKey', 'bucket', 'model'], function(entityKey, bucket, model){
bucket.add(entityKey, model, function(error, result){
bucket.add(entityKey, model, function(error){
callback(error, error ? null : model);

@@ -98,3 +95,3 @@ });

(['entityKey', 'bucket', 'model'], function(entityKey, bucket, model){
bucket.replace(entityKey, model, function(error, result){
bucket.replace(entityKey, model, function(error){
callback(error, error ? null : model);

@@ -129,3 +126,3 @@ });

(['entityKey', 'bucket'], function(entityKey, bucket){
bucket.remove(entityKey, function(error, result){
bucket.remove(entityKey, function(error){
callback(error);

@@ -142,5 +139,2 @@ });

(['entityKey', 'bucket'], function(entityKey, bucket){
if(error){
return callback(error);
}
bucket.touch(entityKey, options, callback);

@@ -170,3 +164,3 @@ })

if(data && 'id' in data){
return callback("object already has an ID");
return callback('object already has an id');
}

@@ -179,3 +173,6 @@

data.id = id;
if(data){
data.id = id;
}
callback(null, percy.entityType + ':' + id);

@@ -190,4 +187,4 @@ });

function createId(callback){
throw new Error("Not Implemented");
function createId(){
throw new Error('Not Implemented');
}

@@ -194,0 +191,0 @@

@@ -10,3 +10,3 @@ var test = require('grape'),

if(!(key in db)){
return callback(true);
return callback(key + ' not in db');
}

@@ -53,3 +53,3 @@ callback(null, db[key]);

function createTestPercy(){
var itemIndex = 0;
var itemIndex = 0,
percy = new Percy('thing', createMockConnector(), createMockValidator());

@@ -70,3 +70,3 @@

t.pass('Percy was created');
t.ok(percy, 'Percy was created');
});

@@ -76,8 +76,10 @@

t.plan(1);
t.plan(2);
var percy = createTestPercy();
var percy = createTestPercy(),
testData = {};
percy.set('abc', {}, function(error, model){
t.pass('model added');
percy.set('abc', testData, function(error, model){
t.notOk(error, 'no error');
t.equal(model, testData, 'model returned');
});

@@ -88,11 +90,14 @@ });

t.plan(2);
t.plan(4);
var percy = createTestPercy();
var percy = createTestPercy(),
testData = {};
percy.set('abc', {}, function(error, model){
t.pass('model added');
percy.set('abc', testData, function(error, model){
t.notOk(error, 'no error');
t.equal(model, testData, 'model returned');
percy.set('abc', {}, function(error, model){
t.pass('model added again');
percy.set('abc', testData, function(error, model){
t.notOk(error, 'no error');
t.equal(model, testData, 'model returned');
});

@@ -104,11 +109,14 @@ });

t.plan(2);
t.plan(4);
var percy = createTestPercy();
var percy = createTestPercy(),
testData = {};
percy.set('abc', {}, function(error, model){
t.pass('model added');
percy.set('abc', testData, function(error, model){
t.notOk(error, 'no error');
t.equal(model, testData, 'model returned');
percy.get('abc', function(error, model){
t.ok(model, 'got model');
t.notOk(error, 'no error');
t.equal(model, testData, 'model returned');
});

@@ -124,4 +132,4 @@ });

percy.get('abc', function(error, model){
t.ok(error, 'error thrown as expected');
percy.get('abc', function(error){
t.equal(error, 'thing:abc not in db', 'got correct error');
});

@@ -132,8 +140,10 @@ });

t.plan(1);
t.plan(2);
var percy = createTestPercy();
var percy = createTestPercy(),
testData = {};
percy.add({}, function(error, model){
t.pass('model added');
percy.add(testData, function(error, model){
t.notOk(error, 'no error');
t.equal(model, testData, 'model returned');
});

@@ -144,11 +154,13 @@ });

t.plan(2);
t.plan(3);
var percy = createTestPercy();
var percy = createTestPercy(),
testData = {};
percy.add({}, function(error, model){
t.pass('model added');
percy.add(testData, function(error, model){
t.notOk(error, 'no error');
t.equal(model, testData, 'model returned');
percy.add(model, function(error, model){
t.ok(error, 'error thrown as expected');
percy.add(model, function(error){
t.equal(error, 'object already has an id', 'correct error');
});

@@ -160,11 +172,13 @@ });

t.plan(2);
t.plan(3);
var percy = createTestPercy();
var percy = createTestPercy(),
testData = {};
percy.add({}, function(error, model){
t.pass('model added');
percy.add(testData, function(error, model){
t.notOk(error, 'no error');
t.equal(model, testData, 'model returned');
percy.remove(model.id, function(error, model){
t.equal(error, null, 'model removed');
percy.remove(model.id, function(error){
t.notOk(error, 'no error');
});

@@ -180,4 +194,4 @@ });

percy.remove('abc', function(error, model){
t.ok(error, 'error thrown as expected');
percy.remove('abc', function(error){
t.equal(error, 'thing:abc not in db', 'error thrown as expected');
});

@@ -207,4 +221,4 @@ });

percy.replace('abc', {b:2}, function(error, model){
t.ok(error, 'error thrown as expected');
percy.replace('abc', {b:2}, function(error){
t.equal(error, 'thing:abc not in db', 'error thrown as expected');
});

@@ -237,4 +251,4 @@ });

percy.update('abc', {b:2}, function(error, model){
t.ok(error, 'error thrown as expected');
percy.update('abc', {b:2}, function(error){
t.equal(error, 'thing:abc not in db', 'error thrown as expected');
});

@@ -288,3 +302,3 @@ });

percy.createId = function(callback){
callback(null, testId);
callback(null, testId);
};

@@ -297,2 +311,39 @@

});
});
test('createKey sets id on data', function(t){
t.plan(4);
var percy = createTestPercy(),
testData = {foo: 'bar'},
testId = 1234567890;
percy.createId = function(callback){
callback(null, testId);
};
percy.createKey(null, testData, function(error, result){
t.notOk(error, 'no error as expected');
t.ok(result, 'result passed as expected');
t.equal(result, 'thing:' + testId, 'result is correct id');
t.equal(testData.id, testId, 'data.id is correct id');
});
});
test('createKey dosent go bang if data is null', function(t){
t.plan(3);
var percy = createTestPercy(),
testData = null,
testId = 1234567890;
percy.createId = function(callback){
callback(null, testId);
};
percy.createKey(null, testData, function(error, result){
t.notOk(error, 'no error as expected');
t.ok(result, 'result passed as expected');
t.equal(result, 'thing:' + testId, 'result is correct id');
});
});
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