Completed
Push — master ( 7b5fbf...d41ae8 )
by greg
03:18
created

test/hbs-helpers.js   A

Complexity

Total Complexity 11
Complexity/F 1

Size

Lines of Code 56
Function Count 11

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 11
nc 1
mnd 0
bc 11
fnc 11
dl 0
loc 56
rs 10
bpm 1
cpm 1
noi 0
c 1
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A hbs-helpers.js ➔ describe(ꞌHelpersꞌ) 0 53 1
1
var chai = require('chai');
2
var Handlebars =require('../src/cli').Handlebars
3
4
describe("Helpers", function () {
5
    describe("lowercase", function () {
6
        it('properly lowercase string', function() {
7
            var value = 'ThiS IS mY String',
8
                rendered = Handlebars.helpers.lowercase(value),
9
                expected = 'this is my string';
10
            chai.expect(rendered).to.eql(expected);
11
        });
12
        it('properly return empty string', function() {
13
            var value = null,
14
                rendered = Handlebars.helpers.lowercase(value),
15
                expected = '';
16
            chai.expect(rendered).to.eql(expected);
17
        });
18
    });
19
    describe("uppercase", function () {
20
        it('properly uppercase string', function() {
21
            var value = 'ThiS IS mY String',
22
                rendered = Handlebars.helpers.uppercase(value),
23
                expected = 'THIS IS MY STRING';
24
            chai.expect(rendered).to.eql(expected);
25
        });
26
        it('properly return empty string', function() {
27
            var value = null,
28
                rendered = Handlebars.helpers.uppercase(value),
29
                expected = '';
30
            chai.expect(rendered).to.eql(expected);
31
        });
32
    });
33
    describe("truncate", function () {
34
        it('properly truncate string', function() {
35
            var value = 'ThiS IS mY String',
36
                length = 10,
37
                rendered = Handlebars.helpers.truncate(value, length),
38
                expected = 'ThiS IS mY...';
39
            chai.expect(rendered).to.eql(expected);
40
        });
41
        it('properly return full string', function() {
42
            var value = 'ThiS IS mY String',
43
                length = 20,
44
                rendered = Handlebars.helpers.truncate(value, length),
45
                expected = 'ThiS IS mY String';
46
            chai.expect(rendered).to.eql(expected);
47
        });
48
        it('properly return empty string', function() {
49
            var value = null,
50
                length = 10,
51
                rendered = Handlebars.helpers.truncate(value, length),
52
                expected = '';
53
            chai.expect(rendered).to.eql(expected);
54
        });
55
    });
56
});