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

empty stringꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
dl 0
loc 7
rs 9.4285
c 1
b 0
f 0
nop 0
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
});