Browse Source

Merge pull request #758 from eordano/fix/precondArgument

Fix #756: Preconditions Invalid Argument
patch-2
Manuel Aráoz 10 years ago
parent
commit
e39543b730
  1. 2
      lib/errors/spec.js
  2. 15
      test/util/preconditions.js

2
lib/errors/spec.js

@ -27,7 +27,7 @@ module.exports = [{
message: format('Invalid network: must be "livenet" or "testnet", got {0}') message: format('Invalid network: must be "livenet" or "testnet", got {0}')
}, { }, {
name: 'InvalidArgument', name: 'InvalidArgument',
message: format('Invalid Argument {0}, {1}') message: format('Invalid Argument' + '\' + (arguments[0] ? \': {0}\' : \'\') + \'')
}, { }, {
name: 'AbstractMethodInvoked', name: 'AbstractMethodInvoked',
message: format('Abstract Method Invokation: {0}') message: format('Abstract Method Invokation: {0}')

15
test/util/preconditions.js

@ -61,4 +61,19 @@ describe('preconditions', function() {
$.checkArgumentType(new PrivateKey(), PrivateKey); $.checkArgumentType(new PrivateKey(), PrivateKey);
}).should.not.throw(); }).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');
});
}); });

Loading…
Cancel
Save