Merge pull request #832 from eordano/fix/coverage/public

Test coverage: last branch untested from PublicKey
This commit is contained in:
Manuel Aráoz 2014-12-19 17:23:19 -03:00
commit cd44787d4c
2 changed files with 3 additions and 1 deletions

View File

@ -131,7 +131,7 @@ PublicKey._isBuffer = function(param) {
* @private * @private
*/ */
PublicKey._isJSON = function(json) { PublicKey._isJSON = function(json) {
return JSUtil.isValidJSON(json) || (json.x && json.y); return !!(JSUtil.isValidJSON(json) || (json.x && json.y));
}; };
/** /**

View File

@ -147,6 +147,8 @@ describe('PublicKey', function() {
expect(function() { expect(function() {
return PublicKey.fromJSON('{"x": "1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a"}'); return PublicKey.fromJSON('{"x": "1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a"}');
}).to.throw(); }).to.throw();
// coverage
PublicKey._isJSON({x: '1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a'}).should.equal(false);
}); });
it('fails if invalid JSON is provided', function() { it('fails if invalid JSON is provided', function() {