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

template.js ➔ ... ➔ it(ꞌgetAbeImport()ꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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