1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 02:58:09 +01:00
metamask-extension/test/unit/components/binary-renderer-test.js

24 lines
642 B
JavaScript
Raw Normal View History

var assert = require('assert')
var BinaryRenderer = require('../../../ui/app/components/binary-renderer')
2017-05-04 23:35:10 +02:00
describe('BinaryRenderer', function () {
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 () {
binaryRenderer = new BinaryRenderer()
})
2017-05-04 23:35:10 +02:00
it('recovers message', function () {
const result = binaryRenderer.hexToText(hex)
assert.equal(result, message)
})
2017-05-04 23:35:10 +02:00
it('recovers message with hex prefix', function () {
const result = binaryRenderer.hexToText('0x' + hex)
assert.equal(result, message)
})
})