Total Complexity | 5 |
Complexity/F | 1 |
Lines of Code | 25 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | |||
2 | var assert = require('assert'); |
||
3 | |||
4 | describe('to-bytes', function() { |
||
5 | |||
6 | let byteData = require('../../index.js'); |
||
7 | |||
8 | // string |
||
9 | it('should turn a 2 char string to bytes', function() { |
||
10 | assert.deepEqual(byteData.toBytes("ab", 8, {"base":10, "char": true}), |
||
11 | [97, 98]); |
||
12 | }); |
||
13 | it('should turn a 2 char string to bytes (hex)', function() { |
||
14 | assert.deepEqual(byteData.toBytes("ab", 8, {"base":16, "char": true}), |
||
15 | ["61", "62"]); |
||
16 | }); |
||
17 | |||
18 | it('should turn a 1 char string to bytes', function() { |
||
19 | assert.deepEqual(byteData.toBytes("a", 8, {"base":10, "char": true}), |
||
20 | [97]); |
||
21 | }); |
||
22 | it('should turn a 1 char string to bytes (hex)', function() { |
||
23 | assert.deepEqual(byteData.toBytes("a", 8, {"base":16, "char": true}), |
||
24 | ["61"]); |
||
25 | }); |
||
26 | }); |
||
27 |