Browse Source

test invalid address

patch-2
Ryan X. Charles 11 years ago
parent
commit
356ddcfa4e
  1. 6
      lib/address.js
  2. 4
      test/test.address.js

6
lib/address.js

@ -11,7 +11,11 @@ function Address(obj) {
};
Address.isValid = function(addrstr) {
var address = new Address().fromString(addrstr);
try {
var address = new Address().fromString(addrstr);
} catch (e) {
return false;
}
return address.isValid();
};

4
test/test.address.js

@ -18,6 +18,10 @@ describe('Address', function() {
Address.isValid(str).should.equal(true);
});
it('should invalidate this valid address string', function() {
Address.isValid(str.substr(1)).should.equal(false);
});
});
describe('#fromPubkey', function() {

Loading…
Cancel
Save