Browse Source

Test coverage: last branch untested from PublicKey

patch-2
Esteban Ordano 10 years ago
parent
commit
4980f7a646
  1. 2
      lib/publickey.js
  2. 2
      test/publickey.js

2
lib/publickey.js

@ -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));
}; };
/** /**

2
test/publickey.js

@ -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() {

Loading…
Cancel
Save