diff --git a/js/amount.js b/js/amount.js index 07a578047..49a60c073 100644 --- a/js/amount.js +++ b/js/amount.js @@ -12,7 +12,7 @@ var UInt160 = function () { // XXX Should standardize on 'i' format or 20 format. }; -UInt160.prototype.from_json = function (j) { +UInt160.from_json = function (j) { var u = new UInt160(); return u.parse_json(j); diff --git a/test/amount-test.js b/test/amount-test.js new file mode 100644 index 000000000..3a7e656a7 --- /dev/null +++ b/test/amount-test.js @@ -0,0 +1,13 @@ +var buster = require("buster"); + +var amount = require("../js/amount.js"); + +buster.testCase("Amount", { + "UInt160" : { + "Parse 0" : function () { + buster.assert.equals(0, amount.UInt160.from_json("0").value); + }, + } +}); + +// vim:sw=2:sts=2:ts=8