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 cmsData = require('../../../src/cli').cmsData; |
||
13 | var Manager = require('../../../src/cli').Manager; |
||
14 | |||
15 | describe('Attr', 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 | * |
||
27 | * |
||
28 | */ |
||
29 | it('new attr', function() { |
||
30 | var attr = new cmsData.attr("article-abe-d20160920T125255138Z.shtml") |
||
31 | chai.expect(attr.str).to.not.be.undefined; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
32 | chai.expect(attr.val.s).to.not.be.undefined; |
||
0 ignored issues
–
show
|
|||
33 | chai.expect(attr.val.s).to.be.equal('d'); |
||
34 | }); |
||
35 | |||
36 | /** |
||
37 | * |
||
38 | * |
||
39 | */ |
||
40 | it('attr.remove', function() { |
||
41 | var attr = new cmsData.attr("article-abe-d20160920T125255138Z.html") |
||
42 | var filename = attr.remove() |
||
43 | chai.expect(filename).to.be.equal('article.html'); |
||
44 | }); |
||
45 | |||
46 | /** |
||
47 | * |
||
48 | * |
||
49 | */ |
||
50 | it('attr.getExtension', function() { |
||
51 | var attr = new cmsData.attr("article-abe-d20160920T125255138Z.html") |
||
52 | var extension = attr.getExtension() |
||
53 | chai.expect(extension).to.be.equal('html'); |
||
54 | }); |
||
55 | |||
56 | /** |
||
57 | * |
||
58 | * |
||
59 | */ |
||
60 | it('attr.insert', function() { |
||
61 | var attr = new cmsData.attr("article-abe-d20160920T125255138Z.html") |
||
62 | var extension = attr.insert('test') |
||
63 | chai.expect(extension).to.be.equal('article-abe-test.html'); |
||
64 | }); |
||
65 | }); |
||
66 |