Test coverage: last branch untested from PublicKey

This commit is contained in:
Esteban Ordano 2014-12-19 16:44:39 -03:00
parent 58f68ba8d2
commit 4980f7a646
2 changed files with 3 additions and 1 deletions

View File

@ -131,7 +131,7 @@ PublicKey._isBuffer = function(param) {
* @private
*/
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() {
return PublicKey.fromJSON('{"x": "1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a"}');
}).to.throw();
// coverage
PublicKey._isJSON({x: '1ff0fe0f7b15ffaa85ff9f4744d539139c252a49710fb053bb9f2b933173ff9a'}).should.equal(false);
});
it('fails if invalid JSON is provided', function() {