Completed
Push — master ( 2c560f...469e75 )
by
unknown
01:58
created

revision.js ➔ ... ➔ before   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 13
rs 9.4285
nop 1
1
var chai = require('chai');
2
var path = require('path');
3
4
var config = require('../src/cli').config
5
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...
6
7
var cmsData = require('../src/cli').cmsData
8
var Manager = require('../src/cli').Manager;
9
var fse = require('fs-extra');
10
11
describe('Revision', function() {
12
  before( function(done) {
13
    Manager.instance.init()
14
      .then(function () {
15
16
        this.fixture = {
17
          tag: fse.readFileSync(__dirname + '/fixtures/templates/article.html', 'utf8'),
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
          jsonArticle: fse.readJsonSync(__dirname + '/fixtures/data/article-1.json'),
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...
19
          jsonHomepage: fse.readJsonSync(__dirname + '/fixtures/data/homepage-1.json')
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...
20
        }
21
        done()
22
        
23
      }.bind(this))
24
  });
25
26
  /**
27
   * cmsData.revision.getVersions
28
   * 
29
   */
30
  it('cmsData.revision.getVersions()', function() {
31
    var versions = cmsData.revision.getVersions('article-1.html')
32
    chai.expect(versions[0].name).to.be.equal('article-1.json');
33
  });
34
35
  /**
36
   * cmsData.revision.getDocumentRevision
37
   * 
38
   */
39
  it('cmsData.revision.getDocumentRevision()', function() {
40
    var version = cmsData.revision.getDocumentRevision('article-1.html')
41
    chai.expect(version.name).to.be.equal('article-1.json');
42
  });
43
44
  /**
45
   * cmsData.revision.getStatusAndDateToFileName
46
   * 
47
   */
48
  it('cmsData.revision.getStatusAndDateToFileName()', function() {
49
    var date = cmsData.revision.getStatusAndDateToFileName('20160919T125255138Z')
50
    chai.expect(date).to.be.equal('2016-09-19T12:52:55.138Z');
51
  });
52
53
  /**
54
   * cmsData.revision.removeStatusAndDateFromFileName
55
   * 
56
   */
57
  it('cmsData.revision.removeStatusAndDateFromFileName()', function() {
58
    var date = cmsData.revision.removeStatusAndDateFromFileName('2016-09-19T12:52:55.138Z')
59
    chai.expect(date).to.be.equal('20160919T125255138Z');
60
  });
61
});
62