aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/components/binary-renderer-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/components/binary-renderer-test.js')
-rw-r--r--test/unit/components/binary-renderer-test.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/unit/components/binary-renderer-test.js b/test/unit/components/binary-renderer-test.js
new file mode 100644
index 000000000..3264faddc
--- /dev/null
+++ b/test/unit/components/binary-renderer-test.js
@@ -0,0 +1,25 @@
+var assert = require('assert')
+var BinaryRenderer = require('../../../ui/app/components/binary-renderer')
+
+describe('BinaryRenderer', function() {
+
+ let binaryRenderer
+ const message = 'Hello, world!'
+ const buffer = new Buffer(message, 'utf8')
+ const hex = buffer.toString('hex')
+
+ beforeEach(function() {
+ binaryRenderer = new BinaryRenderer()
+ })
+
+ it('recovers message', function() {
+ const result = binaryRenderer.hexToText(hex)
+ assert.equal(result, message)
+ })
+
+
+ it('recovers message with hex prefix', function() {
+ const result = binaryRenderer.hexToText('0x' + hex)
+ assert.equal(result, message)
+ })
+})