mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Fix currency from integer.
This commit is contained in:
@@ -23,7 +23,7 @@ Currency.json_rewrite = function (j) {
|
||||
|
||||
Currency.from_json = function (j) {
|
||||
if (j instanceof Currency) return j.clone();
|
||||
else if ('string' === typeof j) return (new Currency()).parse_json(j);
|
||||
else if ('string' === typeof j || 'number' === typeof j) return (new Currency()).parse_json(j);
|
||||
else return new Currency(); // NaN
|
||||
};
|
||||
|
||||
|
||||
@@ -12,6 +12,12 @@ var config = require('../src/js/config').load(require('./config'));
|
||||
// XXX Add test cases that push XRP vs non-XRP behavior.
|
||||
|
||||
buster.testCase("Amount", {
|
||||
"from_number" : {
|
||||
"Number 1" : function () {
|
||||
buster.assert.equals("1/1/rrrrrrrrrrrrrrrrrrrrBZbvji", Amount.from_number(1).to_text_full());
|
||||
},
|
||||
},
|
||||
|
||||
"UInt160" : {
|
||||
"Parse 0" : function () {
|
||||
buster.assert.equals(nbi(), UInt160.from_generic("0")._value);
|
||||
|
||||
Reference in New Issue
Block a user