mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-01 09:35:48 +00:00
xahau-patch
This commit is contained in:
16
packages/xahau-binary-codec/test/quality.test.ts
Normal file
16
packages/xahau-binary-codec/test/quality.test.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
const { quality } = require('../src/coretypes')
|
||||
const { bytesToHex } = require('@xrplf/isomorphic/utils')
|
||||
|
||||
describe('Quality encode/decode', function () {
|
||||
const bookDirectory =
|
||||
'4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F4C3362FE1D0'
|
||||
const expectedQuality = '195796912.5171664'
|
||||
it('can decode', function () {
|
||||
const decimal = quality.decode(bookDirectory)
|
||||
expect(decimal.toString()).toBe(expectedQuality)
|
||||
})
|
||||
it('can encode', function () {
|
||||
const bytes = quality.encode(expectedQuality)
|
||||
expect(bytesToHex(bytes)).toBe(bookDirectory.slice(-16))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user