mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
23 lines
630 B
JavaScript
23 lines
630 B
JavaScript
const assert = require('assert-diff');
|
|
const {Amount} = require('../src/coretypes');
|
|
|
|
describe('Amount', function() {
|
|
it('can be parsed from', function() {
|
|
assert(Amount.from('1000000') instanceof Amount);
|
|
assert.equal(Amount.from('1000000').valueString(), '1000000');
|
|
const fixture = {
|
|
'value': '1',
|
|
'issuer': '0000000000000000000000000000000000000000',
|
|
'currency': 'USD'
|
|
};
|
|
const amt = Amount.from(fixture);
|
|
const rewritten = {
|
|
'value': '1',
|
|
'issuer': 'rrrrrrrrrrrrrrrrrrrrrhoLvTp',
|
|
'currency': 'USD'
|
|
};
|
|
assert.deepEqual(amt.toJSON(), rewritten);
|
|
});
|
|
});
|
|
|