mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
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.
17 lines
594 B
JavaScript
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));
|
|
});
|
|
});
|