2017-03-07 00:03:49 +01:00
|
|
|
var assert = require('assert')
|
2018-03-19 16:11:24 +01:00
|
|
|
var BinaryRenderer = require('../../../old-ui/app/components/binary-renderer')
|
2017-03-07 00:03:49 +01:00
|
|
|
|
2017-05-04 23:35:10 +02:00
|
|
|
describe('BinaryRenderer', function () {
|
2017-03-07 00:03:49 +01:00
|
|
|
let binaryRenderer
|
|
|
|
const message = 'Hello, world!'
|
|
|
|
const buffer = new Buffer(message, 'utf8')
|
|
|
|
const hex = buffer.toString('hex')
|
|
|
|
|
2017-05-04 23:35:10 +02:00
|
|
|
beforeEach(function () {
|
2017-03-07 00:03:49 +01:00
|
|
|
binaryRenderer = new BinaryRenderer()
|
|
|
|
})
|
|
|
|
|
2017-05-04 23:35:10 +02:00
|
|
|
it('recovers message', function () {
|
2017-03-07 00:03:49 +01:00
|
|
|
const result = binaryRenderer.hexToText(hex)
|
|
|
|
assert.equal(result, message)
|
|
|
|
})
|
|
|
|
|
2017-05-04 23:35:10 +02:00
|
|
|
it('recovers message with hex prefix', function () {
|
2017-03-07 00:03:49 +01:00
|
|
|
const result = binaryRenderer.hexToText('0x' + hex)
|
|
|
|
assert.equal(result, message)
|
|
|
|
})
|
|
|
|
})
|