Completed
Push — master ( bf7a8a...82793c )
by
unknown
02:04
created

test/template.js   A

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 50
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
B template.js ➔ describe(ꞌTemplateꞌ) 0 39 1
1
var chai = require('chai');
2
3
var config = require('../src/cli').config
4
config.set({root: __dirname + '/fixtures'})
0 ignored issues
show
Compatibility introduced by
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
5
6
var getTemplate = require('../src/cli').getTemplate
7
var includePartials = require('../src/cli/helpers/abe-template').includePartials
8
var getAbeImport = require('../src/cli/helpers/abe-template').getAbeImport
9
var Manager = require('../src/cli').Manager;
10
var fse = require('fs-extra');
11
12
describe('Template', function() {
13
  before( function(done) {
14
    Manager.instance.init()
15
      .then(function () {
16
        this.fixture = {
17
          template: fse.readFileSync(__dirname + '/fixtures/templates/article.html', 'utf-8')
0 ignored issues
show
Compatibility introduced by
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
18
        }
19
        done()
20
        
21
      }.bind(this))
22
  });
23
24
  /**
25
   * getAbeImport
26
   * 
27
   */
28
  it('getAbeImport()', function() {
29
    var res = getAbeImport(this.fixture.template)
30
    chai.expect(res).to.have.length(4);
31
  });
32
33
  /**
34
   * includePartials
35
   * 
36
   */
37
  it('includePartials()', function() {
38
    var template = includePartials(this.fixture.template)
39
    chai.expect(template).to.contain("{{abe type='text' key='title' desc='titre' tab='default'}}");
40
  });
41
42
  /**
43
   * getTemplate
44
   * 
45
   */
46
  it('getTemplate()', function() {
47
    var template = getTemplate('article')
48
    chai.expect(template).to.contain("{{abe type='text' key='title' desc='titre' tab='default' order='1'}}");
49
  });
50
});
51