test_js/utilsSpec.js   A
last analyzed

Complexity

Total Complexity 14
Complexity/F 1

Size

Lines of Code 47
Function Count 14

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 47
rs 10
wmc 14
mnd 0
bc 14
fnc 14
bpm 1
cpm 1
noi 0

7 Functions

Rating   Name   Duplication   Size   Complexity  
A utilsSpec.js ➔ describe(ꞌscaleStrꞌ) 0 6 1
A utilsSpec.js ➔ describe(ꞌserializeToJSONꞌ) 0 5 1
A utilsSpec.js ➔ describe(ꞌguidꞌ) 0 5 1
A utilsSpec.js ➔ describe(ꞌpolygonꞌ) 0 6 1
A utilsSpec.js ➔ describe(ꞌtranslateStrꞌ) 0 6 1
A utilsSpec.js ➔ describe(ꞌisOverrideꞌ) 0 6 1
A utilsSpec.js ➔ describe(ꞌgetDigitSizeꞌ) 0 5 1
1
var jsondash = require('../flask_jsondash/static/js/utils');
2
3
describe('serializeToJSON', function(){
4
    it('should serialize properly', function(){
5
        // TODO!
6
    });
7
});
8
9
describe('isOverride', function(){
10
    it('should override values', function(){
11
        expect(jsondash.util.isOverride({override: true})).toBe(true);
12
        expect(jsondash.util.isOverride({override: false})).toBe(false);
13
    });
14
});
15
16
describe('guid', function(){
17
    it('should generated a guid', function(){
18
        expect(jsondash.util.guid().length).toBe(36);
19
    });
20
});
21
22
describe('polygon', function(){
23
    it('should create a polygon svg string', function(){
24
        expect(jsondash.util.polygon(['30', '60'])).toBe('M30L60Z');
25
        expect(jsondash.util.polygon([])).toBe('MZ');
26
    });
27
});
28
29
describe('getDigitSize', function(){
30
    it('should resize the text based on digits', function(){
31
        // TODO!
32
    });
33
});
34
35
describe('translateStr', function(){
36
    it('should create the string for a svg translation value', function(){
37
        expect(jsondash.util.translateStr(10, 20)).toBe('translate(10,20)');
38
        expect(jsondash.util.translateStr('50%', '50%')).toBe('translate(50%,50%)');
39
    });
40
});
41
42
describe('scaleStr', function(){
43
    it('should create the string for a svg scale value', function(){
44
        expect(jsondash.util.scaleStr(10, 20)).toBe('scale(10,20)');
45
        expect(jsondash.util.scaleStr('50%', '50%')).toBe('scale(50%,50%)');
46
    });
47
});
48