more amount minimum abs test fixes

This commit is contained in:
mDuo13
2015-08-26 12:26:47 -07:00
parent 297fb2483d
commit 2b600a1e4e

View File

@@ -1224,15 +1224,21 @@ describe('Amount', function() {
}); });
it('from_json minimum IOU', function() { it('from_json minimum IOU', function() {
const amt = Amount.from_json('-1e-81/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh'); const amt = Amount.from_json('1e-81/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh');
assert.strictEqual(amt.to_text(), '1000000000000000e-96'); assert.strictEqual(amt.to_text(), '1000000000000000e-96');
assert.strictEqual(amt.to_text(), Amount.min_value); assert.strictEqual(amt.to_text(), Amount.min_value);
}); });
it('from_json negative minimum IOU', function() {
const amt = Amount.from_json('-1e-81/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh');
assert.strictEqual(amt.to_text(), '-1000000000000000e-96');
assert.strictEqual(amt.negate().to_text(), Amount.min_value);
});
it('from_json exceed minimum IOU', function() { it('from_json exceed minimum IOU', function() {
assert.throws(function() { assert.throws(function() {
Amount.from_json('-1e-82/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh'); Amount.from_json('1e-82/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh');
}, 'Exceeding min value of ' + Amount.min_value); }, 'Exceeding min absolute value of ' + Amount.min_value);
}); });
it('from_json maximum IOU', function() { it('from_json maximum IOU', function() {