Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "percy", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A persistance layer that plays nice with Couchbase", | ||
@@ -5,0 +5,0 @@ "main": "percy.js", |
@@ -167,2 +167,3 @@ var kgo = require('kgo'), | ||
} | ||
percy.createId(function(error, id){ | ||
@@ -176,2 +177,4 @@ if(error){ | ||
}); | ||
return; | ||
} | ||
@@ -178,0 +181,0 @@ |
@@ -245,2 +245,40 @@ var test = require('grape'), | ||
}); | ||
}); | ||
test('handels valid key from createKey', function(t){ | ||
t.plan(3); | ||
var percy = createTestPercy(), | ||
expectedResult = { | ||
foo: 'bar', | ||
id: 1 | ||
}, | ||
testkeys = 0; | ||
percy.createId = function(callback){ | ||
callback(null, ++testkeys); | ||
}; | ||
percy.add({foo: 'bar'}, function(error, result){ | ||
t.notOk(error, 'no error as expected'); | ||
t.ok(result, 'result passed as expected'); | ||
t.deepEqual(result, expectedResult, 'correct error passed'); | ||
}); | ||
}); | ||
test('createKey callsback only once with correct id', function(t){ | ||
t.plan(3); | ||
var percy = createTestPercy(), | ||
testId = 1234567890; | ||
percy.createId = function(callback){ | ||
callback(null, testId); | ||
}; | ||
percy.createKey(null, {foo: 'bar'}, 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'); | ||
}); | ||
}); |
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
15025
403