Completed
Push — master ( b89808...cd3036 )
by greg
02:02
created

test/cms/editor/form.js   A

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 40
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
B form.js ➔ describe(ꞌFormꞌ) 0 26 1
1
var chai = require('chai');
2
var sinonChai = require('sinon-chai')
3
var expect = chai.expect
4
chai.use(sinonChai)
5
var sinon = require('sinon');
6
var path = require('path');
7
var fse = require('fs-extra');
8
9
var config = require('../../../src/cli').config
10
config.set({root: path.join(process.cwd(), 'test', 'fixtures')})
11
12
var cmsEditor = require('../../../src/cli').cmsEditor;
13
var Manager = require('../../../src/cli').Manager;
14
15
describe('Form', function() {
16
  before( function(done) {
17
    Manager.instance.init()
18
      .then(function () {
19
        this.fixture = {}
20
        done()
21
        
22
      }.bind(this))
23
  });
24
25
  /**
26
   * getTemplatesTexts
27
   * 
28
   */
29
  it('new Form', function() {
30
    // stub
31
    var sinonInstance = sinon.sandbox.create();
0 ignored issues
show
Unused Code introduced by
The variable sinonInstance seems to be never used. Consider removing it.
Loading history...
32
    // sinonInstance.stub(fse, 'readFileSync');
33
    
34
    var form = new cmsEditor.form()
35
    form.add({key: 'test'})
36
    chai.expect(form._form.default.item[0].key).to.be.equal('test');
37
    chai.expect(form.dontHaveKey('test')).to.be.equal(false);
38
    chai.expect(form.form.default.item.length).to.be.above(0);
39
  });
40
});
41