Comparing version 3.0.2 to 3.0.3
{ | ||
"name": "percy", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "A persistance layer that plays nice with Couchbase", | ||
@@ -5,0 +5,0 @@ "main": "percy.js", |
16
percy.js
@@ -91,3 +91,13 @@ var kgo = require('kgo'), | ||
percy.bucket.getMulti(keys, done); | ||
percy.bucket.getMulti(keys, function(error, result){ | ||
if(error){ | ||
if(parseInt(error, 10)){ | ||
return done(new Error('No such key (' + error + ')')); | ||
} | ||
return done(error); | ||
} | ||
done(null, result); | ||
}); | ||
}) | ||
@@ -176,3 +186,5 @@ (['results'], function(results){ | ||
for(var property in data){ | ||
model[property] = data[property]; | ||
if(property !== 'id'){ | ||
model[property] = data[property]; | ||
} | ||
} | ||
@@ -179,0 +191,0 @@ percy.replace(id, model, callback); |
@@ -228,3 +228,3 @@ var test = require('tape'), | ||
t.plan(2); | ||
t.plan(3); | ||
@@ -236,4 +236,7 @@ var percy = createTestPercy(); | ||
percy.update(model.id, {b:2}, function(error, model){ | ||
var originalId = model.id; | ||
percy.update(model.id, {id: 123, b:2}, function(error, model){ | ||
// remove the id for comparison | ||
t.equal(model.id, originalId, 'id was not changed'); | ||
delete model.id; | ||
@@ -371,1 +374,33 @@ | ||
}); | ||
test('getMulti stupid errors', function(t){ | ||
t.plan(3); | ||
var percy = new Percy('thing', { | ||
getMulti: function(keys, callback){ | ||
callback(123); | ||
} | ||
}, createMockValidator()); | ||
percy.getMulti(['foo', 'bar'], function(error, results){ | ||
t.ok(error instanceof Error, 'correct error'); | ||
t.equal(error.message, 'No such key (123)', 'correct error message'); | ||
t.notOk(results, 'no results returned'); | ||
}); | ||
}); | ||
test('getMulti normal error handeling', function(t){ | ||
t.plan(2); | ||
var testError = 'BANG!!!!', | ||
percy = new Percy('thing', { | ||
getMulti: function(keys, callback){ | ||
callback(testError); | ||
} | ||
}, createMockValidator()); | ||
percy.getMulti(['foo', 'bar'], function(error, results){ | ||
t.equal(error, testError, 'correct error message'); | ||
t.notOk(results, 'no results returned'); | ||
}); | ||
}); |
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
18336
496