From 8ebceaa53e089eeefc4696ad99d30f5d16b4d1b6 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Thu, 11 Oct 2012 16:25:01 -0700 Subject: [PATCH] UT: Initial check in unit tests for amount.js. --- js/amount.js | 2 +- test/amount-test.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/amount-test.js diff --git a/js/amount.js b/js/amount.js index 07a5780476..49a60c0739 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 0000000000..3a7e656a74 --- /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