Throw an error when Amount or Fee contains a decimal (Fix #31)

Thanks to @jwbusch for review
This commit is contained in:
Elliot Lee
2019-07-26 16:53:25 -07:00
parent b775a6f3c8
commit da5edb0b3b
15 changed files with 413 additions and 162 deletions

View File

@@ -16,15 +16,15 @@ describe('ripple-binary-codec', function() {
entries.forEach((t, test_n) => {
// eslint-disable-next-line max-len
it(`${name}[${test_n}] can encode ${truncateForDisplay(json(t.json))} to ${truncateForDisplay(t.binary)}`,
() => {
assert.equal(t.binary, encode(t.json));
});
() => {
assert.equal(t.binary, encode(t.json));
});
// eslint-disable-next-line max-len
it(`${name}[${test_n}] can decode ${truncateForDisplay(t.binary)} to ${truncateForDisplay(json(t.json))}`,
() => {
const decoded = decode(t.binary);
assert.deepEqual(t.json, decoded);
});
() => {
const decoded = decode(t.binary);
assert.deepEqual(t.json, decoded);
});
});
});
}
@@ -34,10 +34,10 @@ describe('ripple-binary-codec', function() {
describe('ledgerData', function() {
fixtures.ledgerData.forEach((t, test_n) => {
it(`ledgerData[${test_n}] can decode ${t.binary} to ${json(t.json)}`,
() => {
const decoded = decodeLedgerData(t.binary);
assert.deepEqual(t.json, decoded);
});
() => {
const decoded = decodeLedgerData(t.binary);
assert.deepEqual(t.json, decoded);
});
});
})
});