diff --git a/test/amount-test.js b/test/amount-test.js index 48ff2843..efdf7ca7 100644 --- a/test/amount-test.js +++ b/test/amount-test.js @@ -18,8 +18,22 @@ describe('Amount', function() { }); describe('from_number', function() { it('Number 1', function() { - // TODO: ask for validation of this change when submitting the pull request - assert.strictEqual(Amount.from_number(1).to_text_full(), '1/XRP/rrrrrrrrrrrrrrrrrrrrBZbvji'); + assert.strictEqual(Amount.from_number(1).to_text_full(), '1/1/rrrrrrrrrrrrrrrrrrrrBZbvji'); + }); + it('Number 2', function() { + assert.strictEqual(Amount.from_number(2).to_text_full(), '2/1/rrrrrrrrrrrrrrrrrrrrBZbvji'); + }); + it('Multiply 2 "1" with 3 "1", by product_human', function () { + assert.strictEqual(Amount.from_number(2).product_human(Amount.from_number(3)).to_text_full(), '6/1/rrrrrrrrrrrrrrrrrrrrBZbvji'); + }); + it('Multiply 3 USD with 3 "1"', function () { + assert.strictEqual(Amount.from_json('3/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh').multiply(Amount.from_number(3)).to_text_full(), '9/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh'); + }); + it('Multiply -1 "1" with 3 USD', function () { + assert.strictEqual(Amount.from_number(-1).multiply(Amount.from_json('3/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh')).to_text_full(), '-3/1/rrrrrrrrrrrrrrrrrrrrBZbvji'); + }); + it('Multiply -1 "1" with 3 USD, by product_human', function () { + assert.strictEqual(Amount.from_number(-1).product_human(Amount.from_json('3/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh')).to_text_full(), '-3/1/rrrrrrrrrrrrrrrrrrrrBZbvji'); }); }); describe('text_full_rewrite', function() {