diff --git a/lib/errors/spec.js b/lib/errors/spec.js index b035f0fa9..8b6218749 100644 --- a/lib/errors/spec.js +++ b/lib/errors/spec.js @@ -27,7 +27,7 @@ module.exports = [{ message: format('Invalid network: must be "livenet" or "testnet", got {0}') }, { name: 'InvalidArgument', - message: format('Invalid Argument {0}, {1}') + message: format('Invalid Argument' + '\' + (arguments[0] ? \': {0}\' : \'\') + \'') }, { name: 'AbstractMethodInvoked', message: format('Abstract Method Invokation: {0}') diff --git a/test/util/preconditions.js b/test/util/preconditions.js index 36f747e96..5db9bb9db 100644 --- a/test/util/preconditions.js +++ b/test/util/preconditions.js @@ -61,4 +61,19 @@ describe('preconditions', function() { $.checkArgumentType(new PrivateKey(), PrivateKey); }).should.not.throw(); }); + + it('formats correctly a message on InvalidArgument()', function() { + var error = new errors.InvalidArgument(); + error.message.should.equal('Invalid Argument'); + }); + + it('formats correctly a message on checkArgument', function() { + var error; + try { + $.checkArgument(null, 'parameter must be provided'); + } catch (e) { + error = e; + } + error.message.should.equal('Invalid Argument: parameter must be provided'); + }); });