added tests

This commit is contained in:
louisbuchbinder
2017-07-09 09:23:17 -07:00
parent 280b2a7461
commit e029a93cf3

View File

@@ -63,6 +63,26 @@ describe('Base58', function () {
}); });
}); });
}); });
describe('when passed a negative number', function () {
it('throws an error', function () {
assert.throws(function () {
base58.encode(-300);
}, function (err) {
return err.message === 'Value passed is not a non-negative safe integer.';
});
});
});
describe('when passed a non-safe integer', function () {
it('throws an error', function () {
assert.throws(function () {
base58.encode(1E100);
}, function (err) {
return err.message === 'Value passed is not a non-negative safe integer.';
});
});
});
}); });
describe('.decode', function () { describe('.decode', function () {