mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 11:45:49 +00:00
30 lines
699 B
TypeScript
30 lines
699 B
TypeScript
import assert from 'assert'
|
|
import * as utils from '../src/utils'
|
|
|
|
describe('utils', function () {
|
|
it('hexToBytes - empty', () => {
|
|
assert.deepEqual(utils.hexToBytes(''), [])
|
|
})
|
|
|
|
it('hexToBytes - zero', () => {
|
|
assert.deepEqual(utils.hexToBytes('000000'), [0, 0, 0])
|
|
})
|
|
|
|
it('hexToBytes - DEADBEEF', () => {
|
|
assert.deepEqual(utils.hexToBytes('DEADBEEF'), [222, 173, 190, 239])
|
|
})
|
|
|
|
it('bytesToHex - DEADBEEF', () => {
|
|
assert.deepEqual(utils.bytesToHex([222, 173, 190, 239]), 'DEADBEEF')
|
|
})
|
|
|
|
it('bytesToHex - DEADBEEF (Uint8Array)', () => {
|
|
assert.deepEqual(
|
|
utils.bytesToHex(new Uint8Array([222, 173, 190, 239])),
|
|
'DEADBEEF',
|
|
)
|
|
})
|
|
})
|
|
|
|
export {}
|