Issues (791)

test/attributes.js (4 issues)

1
var chai = require('chai');
2
var path = require('path');
3
4
var config = require('../src/cli').config
5
config.set({root: path.join(__dirname,'fixtures')})
6
7
var cmsData = require('../src/cli').cmsData;
8
var Manager = require('../src/cli').Manager;
9
var fse = require('fs-extra');
10
11
describe('attributes', function() {
12
  before( function(done) {
13
    Manager.instance.init()
14
      .then(function () {
15
        Manager.instance._whereKeys = ['title', 'priority', 'abe_meta', 'articles']
16
        Manager.instance.updateList()
17
18
        this.fixture = {
19
          tag: fse.readFileSync(__dirname + '/fixtures/templates/article.html', 'utf8'),
0 ignored issues
show
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
20
          html: fse.readFileSync(__dirname + '/fixtures/templates/article.html', 'utf8'),
0 ignored issues
show
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
21
          json: fse.readJsonSync(__dirname + '/fixtures/data/article-1.json')
0 ignored issues
show
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
22
        }
23
        done()
24
        
25
      }.bind(this))
26
  });
27
28
  /**
29
   * cmsData.values.removeDuplicate
30
   * 
31
   */
32
  it('cmsData.values.removeDuplicate', function() {
33
    var newJson = cmsData.values.removeDuplicate(this.fixture.html, this.fixture.json)
34
    chai.expect(newJson.title).to.be.undefined;
0 ignored issues
show
The result of the property access to chai.expect(newJson.title).to.be.undefined is not used.
Loading history...
35
  });
36
37
  /**
38
   * cmsData.attributes.sanitizeSourceAttribute
39
   * 
40
   */
41
  it('cmsData.attributes.sanitizeSourceAttribute', function() {
42
  	// not sure what it does
43
  });
44
45
  /**
46
   * cmsData.attributes.getAll
47
   * 
48
   */
49
  it('cmsData.attributes.getAll()', function(done) {
50
    var attributes = cmsData.attributes.getAll(this.fixture.tag, this.fixture.jsonArticle)
51
    chai.expect(attributes.sourceString).to.contain('select');
52
    done();
53
  });
54
});
55