Browse Source

test/basic: verify our addr/privkey checks properly fail on invalid-data tests

patch-2
Jeff Garzik 12 years ago
parent
commit
01ab4b4c35
  1. 16
      test/basic.js

16
test/basic.js

@ -92,6 +92,22 @@ function is_valid(datum)
function is_invalid(datum)
{
if (datum.length < 1)
throw new Error("Bad test");
// ignore succeeding elements, as comments
var b58 = datum[0];
var privkey = new PrivateKey(b58);
var addr = new Address(b58);
var valid = true;
try {
privkey.validate();
addr.validate();
} catch(e) {
valid = false;
}
assert.equal(valid, false);
}
var dataValid = JSON.parse(fs.readFileSync('test/base58_keys_valid.json'));

Loading…
Cancel
Save