test invalid address
This commit is contained in:
parent
ac47796acd
commit
356ddcfa4e
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
@ -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…
Reference in New Issue