Files
xahau.js/packages/ripple-binary-codec/test/quality-test.js
Elliot Lee d3b29945ea Restrict to node version 10
Many unit tests fail under node 12. It is possible that some of these
are caused by issues in node that will be fixed in the future.

This also removes the dependency on 'assert-diff' since it is not
necessary. It can easily be re-added in the future, if needed.
2019-07-16 21:55:42 -07:00

17 lines
594 B
JavaScript

const assert = require('assert');
const {quality, binary: {bytesToHex}} = require('../src/coretypes');
describe('Quality encode/decode', function() {
const bookDirectory =
'4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F4C3362FE1D0';
const expectedQuality = '195796912.5171664';
it('can decode', function() {
const decimal = quality.decode(bookDirectory);
assert.equal(decimal.toString(), expectedQuality);
});
it('can encode', function() {
const bytes = quality.encode(expectedQuality);
assert.equal(bytesToHex(bytes), bookDirectory.slice(-16));
});
});