Passed
Branch master (9a7ed1)
by Rafael S.
01:20
created

test/to-bytes/strings.js   A

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 25
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 25
rs 10
wmc 5
mnd 0
bc 5
fnc 5
bpm 1
cpm 1
noi 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