Passed
Push — master ( beba88...91d9d9 )
by Björn
02:26
created

test.01.staticpages.js ➔ ???   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 130

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 3
Metric Value
cc 1
c 3
b 0
f 3
nc 1
dl 0
loc 130
rs 8.2857
nop 0

6 Functions

Rating   Name   Duplication   Size   Complexity  
A test.01.staticpages.js ➔ ... ➔ it(ꞌbuilds a page with custom partialsꞌ) 0 23 1
A test.01.staticpages.js ➔ ... ➔ beforeEach 0 4 1
A test.01.staticpages.js ➔ ... ➔ it(ꞌbuilds a page with a custom layoutꞌ) 0 23 1
B test.01.staticpages.js ➔ ... ➔ it(ꞌbuilds a page with custom helpersꞌ) 0 24 1
A test.01.staticpages.js ➔ ... ➔ it(ꞌbuilds a page with a default layoutꞌ) 0 23 1
B test.01.staticpages.js ➔ ... ➔ it(ꞌbuilds a page with a preset layout in sub folderꞌ) 0 24 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
import { src, dest } from 'vinyl-fs';
0 ignored issues
show
Unused Code introduced by Björn Bartels
The variable src seems to be never used. Consider removing it.
Loading history...
2
//import assert from 'assert';
3
import equal from 'assert-dir-equal';
4
import Patternlibrary from '..';
5
import rimraf from 'rimraf';
6
import mkdirp from 'mkdirp';
7
8
const FIXTURES = 'test/fixtures.staticpages/';
9
10
const CLEAN_UP = !true;
11
12
var patternlibraryOptions = {
13
    verbose: false,
14
    dest : FIXTURES + 'build',
15
    root    : FIXTURES + 'pages/',
16
    layouts : FIXTURES + 'layouts',
17
    partials: FIXTURES + 'partials'
18
}
19
20
21
describe('Patternlibrary static page genarator:', () => {
22
23
    beforeEach(function(done) {
24
        this.timeout(5000); // A very long environment setup.
25
        done();
26
    });
27
28
    it('builds a page with a default layout', function (done) {
29
30
        patternlibraryOptions = {
31
            verbose : false,
32
            dest    : FIXTURES + 'basic/build',
33
            root    : FIXTURES + 'basic/pages/',
34
            layouts : FIXTURES + 'basic/layouts/',
35
            partials: FIXTURES + 'basic/partials/',
36
            nogui   : true,
37
            testing : true
38
        };
39
        rimraf.sync(FIXTURES + 'basic/build'); mkdirp(FIXTURES + 'basic/build');
40
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
41
    
42
        p.run();
43
    
44
        setTimeout( function () {
45
            equal(FIXTURES + 'basic/expected/index.html', FIXTURES + 'basic/build/index.html');
46
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'basic/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
47
            done();
48
        }, 250);
49
    
50
    });
51
52
    it('builds a page with a custom layout', function (done) {
53
54
        patternlibraryOptions = {
55
            verbose : false,
56
            dest    : FIXTURES + 'layouts/build',
57
            root    : FIXTURES + 'layouts/pages/',
58
            layouts : FIXTURES + 'layouts/layouts/',
59
            partials: FIXTURES + 'layouts/partials/',
60
            nogui   : true,
61
            testing : true
62
        };
63
        rimraf.sync(FIXTURES + 'layouts/build'); mkdirp(FIXTURES + 'layouts/build');
64
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
65
    
66
        p.run();
67
    
68
        setTimeout( function () {
69
            equal(FIXTURES + 'layouts/expected/index.html', FIXTURES + 'layouts/build/index.html');
70
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'layouts/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
71
            done();
72
        }, 250);
73
    
74
    });
75
 
76
    it('builds a page with a preset layout in sub folder', function (done) {
77
    
78
        patternlibraryOptions = {
79
            verbose : false,
80
            dest    : FIXTURES + 'page-layouts/build',
81
            root    : FIXTURES + 'page-layouts/pages/',
82
            layouts : FIXTURES + 'page-layouts/layouts/',
83
            partials: FIXTURES + 'page-layouts/partials/',
84
            nogui   : true,
85
            testing : true
86
        };
87
        rimraf.sync(FIXTURES + 'page-layouts/build'); mkdirp(FIXTURES + 'page-layouts/build');
88
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
89
    
90
        p.run();
91
    
92
        setTimeout( function () {
93
            equal(FIXTURES + 'page-layouts/expected/index.html', FIXTURES + 'page-layouts/build/index.html');
94
            equal(FIXTURES + 'page-layouts/expected/sub/index.html', FIXTURES + 'page-layouts/build/sub/index.html');
95
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'page-layouts/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
96
            done();
97
        }, 250);
98
    
99
    });
100
101
    it('builds a page with custom partials', function (done) {
102
    
103
        patternlibraryOptions = {
104
            verbose : false,
105
            dest    : FIXTURES + 'partials/build',
106
            root    : FIXTURES + 'partials/pages/',
107
            layouts : FIXTURES + 'partials/layouts/',
108
            partials: FIXTURES + 'partials/partials/',
109
            nogui   : true,
110
            testing : true
111
        };
112
        rimraf.sync(FIXTURES + 'partials/build'); mkdirp(FIXTURES + 'partials/build');
113
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
114
    
115
        p.run();
116
    
117
        setTimeout( function () {
118
            equal(FIXTURES + 'partials/expected/index.html', FIXTURES + 'partials/build/index.html');
119
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'partials/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
120
            done();
121
        }, 250);
122
    
123
    });
124
125
    it('builds a page with custom helpers', function (done) {
126
    
127
        patternlibraryOptions = {
128
            verbose : false,
129
            dest    : FIXTURES + 'helpers/build',
130
            root    : FIXTURES + 'helpers/pages/',
131
            layouts : FIXTURES + 'helpers/layouts/',
132
            partials: FIXTURES + 'helpers/partials/',
133
            helpers : FIXTURES + 'helpers/helpers/',
134
            nogui   : true,
135
            testing : true
136
        };
137
        rimraf.sync(FIXTURES + 'helpers/build'); mkdirp(FIXTURES + 'helpers/build');
138
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
139
    
140
        p.run();
141
    
142
        setTimeout( function () {
143
            equal(FIXTURES + 'helpers/expected/index.html', FIXTURES + 'helpers/build/index.html');
144
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'partials/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
145
            done();
146
        }, 250);
147
    
148
    });
149
150
});
151
152
describe('Patternlibrary, injecting (custom) data, ', () => {
153
154
    it('builds a page with custom page data', function (done) {
155
    
156
        patternlibraryOptions = {
157
            verbose : false,
158
            dest    : FIXTURES + 'data-page/build',
159
            root    : FIXTURES + 'data-page/pages/',
160
            layouts : FIXTURES + 'data-page/layouts/',
161
            partials: FIXTURES + 'data-page/partials/',
162
            nogui   : true,
163
            testing : true
164
        };
165
        rimraf.sync(FIXTURES + 'data-page/build'); mkdirp(FIXTURES + 'data-page/build');
166
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
167
    
168
        p.run();
169
    
170
        setTimeout( function () {
171
            equal(FIXTURES + 'data-page/expected/index.html', FIXTURES + 'data-page/build/index.html');
172
            equal(FIXTURES + 'data-page/expected/pl/patternlibrary.json', FIXTURES + 'data-page/build/pl/patternlibrary.json');
173
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'data-page/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
174
            done();
175
        }, 250);
176
    
177
    });
178
179 View Code Duplication
    it('builds a page with external JS data', function (done) {
0 ignored issues
show
Duplication introduced by Björn Bartels
This code seems to be duplicated in your project.
Loading history...
180
    
181
        patternlibraryOptions = {
182
            verbose : false,
183
            dest    : FIXTURES + 'data-js/build',
184
            root    : FIXTURES + 'data-js/pages/',
185
            layouts : FIXTURES + 'data-js/layouts/',
186
            partials: FIXTURES + 'data-js/partials/',
187
            data    : FIXTURES + 'data-js/data/',
188
            nogui   : true,
189
            testing : true
190
        };
191
        rimraf.sync(FIXTURES + 'data-js/build'); mkdirp(FIXTURES + 'data-js/build');
192
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
193
    
194
        p.run();
195
    
196
        setTimeout( function () {
197
            equal(FIXTURES + 'data-js/expected/index.html', FIXTURES + 'data-js/build/index.html');
198
            equal(FIXTURES + 'data-js/expected/pl/patternlibrary.json', FIXTURES + 'data-js/build/pl/patternlibrary.json');
199
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'data-js/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
200
            done();
201
        }, 250);
202
    
203
    });
204
205 View Code Duplication
    it('builds a page with external JSON data', function (done) {
0 ignored issues
show
Duplication introduced by Björn Bartels
This code seems to be duplicated in your project.
Loading history...
206
    
207
        patternlibraryOptions = {
208
            verbose : false,
209
            dest    : FIXTURES + 'data-json/build',
210
            root    : FIXTURES + 'data-json/pages/',
211
            layouts : FIXTURES + 'data-json/layouts/',
212
            partials: FIXTURES + 'data-json/partials/',
213
            data    : FIXTURES + 'data-json/data/',
214
            nogui   : true,
215
            testing : true
216
        };
217
        rimraf.sync(FIXTURES + 'data-json/build'); mkdirp(FIXTURES + 'data-json/build');
218
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
219
    
220
        p.run();
221
    
222
        setTimeout( function () {
223
            equal(FIXTURES + 'data-json/expected/index.html', FIXTURES + 'data-json/build/index.html');
224
            equal(FIXTURES + 'data-json/expected/pl/patternlibrary.json', FIXTURES + 'data-json/build/pl/patternlibrary.json');
225
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'data-json/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
226
            done();
227
        }, 250);
228
    
229
    });
230
231 View Code Duplication
    it('builds a page with an array of external JSON data', function (done) {
0 ignored issues
show
Duplication introduced by Björn Bartels
This code seems to be duplicated in your project.
Loading history...
232
    
233
        patternlibraryOptions = {
234
            verbose : false,
235
            dest    : FIXTURES + 'data-array/build',
236
            root    : FIXTURES + 'data-array/pages/',
237
            layouts : FIXTURES + 'data-array/layouts/',
238
            partials: FIXTURES + 'data-array/partials/',
239
            data    : [FIXTURES + 'data-array/data/', FIXTURES + 'data-array/data-extra/'],
240
            nogui   : true,
241
            testing : true
242
        };
243
        rimraf.sync(FIXTURES + 'data-array/build'); mkdirp(FIXTURES + 'data-array/build');
244
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
245
    
246
        p.run();
247
    
248
        setTimeout( function () {
249
            equal(FIXTURES + 'data-array/expected/index.html', FIXTURES + 'data-array/build/index.html');
250
            equal(FIXTURES + 'data-array/expected/pl/patternlibrary.json', FIXTURES + 'data-array/build/pl/patternlibrary.json');
251
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'data-array/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
252
            done();
253
        }, 250);
254
    
255
    });
256
257 View Code Duplication
    it('builds a page with external YAML data', function (done) {
0 ignored issues
show
Duplication introduced by Björn Bartels
This code seems to be duplicated in your project.
Loading history...
258
    
259
        patternlibraryOptions = {
260
            verbose : false,
261
            dest    : FIXTURES + 'data-yaml/build',
262
            root    : FIXTURES + 'data-yaml/pages/',
263
            layouts : FIXTURES + 'data-yaml/layouts/',
264
            partials: FIXTURES + 'data-yaml/partials/',
265
            data    : FIXTURES + 'data-yaml/data/',
266
            nogui   : true,
267
            testing : true
268
        };
269
        rimraf.sync(FIXTURES + 'data-yaml/build'); mkdirp(FIXTURES + 'data-yaml/build');
270
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
271
    
272
        p.run();
273
    
274
        setTimeout( function () {
275
            equal(FIXTURES + 'data-yaml/expected/index.html', FIXTURES + 'data-yaml/build/index.html');
276
            equal(FIXTURES + 'data-yaml/expected/pl/patternlibrary.json', FIXTURES + 'data-yaml/build/pl/patternlibrary.json');
277
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'data-yaml/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
278
            done();
279
        }, 250);
280
    
281
    });
282
283
});
284
285
286
describe('Patternlibrary, assigning', () => {
287
288
    it('{{page}} variable that stores the current page', function (done) {
289
    
290
        patternlibraryOptions = {
291
            verbose : false,
292
            dest    : FIXTURES + 'variable-page/build',
293
            root    : FIXTURES + 'variable-page/pages/',
294
            layouts : FIXTURES + 'variable-page/layouts/',
295
            partials: FIXTURES + 'variable-page/partials/',
296
            nogui   : true,
297
            testing : true
298
        };
299
        rimraf.sync(FIXTURES + 'variable-page/build'); mkdirp(FIXTURES + 'variable-page/build');
300
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
301
    
302
        p.run();
303
    
304
        setTimeout( function () {
305
            equal(FIXTURES + 'variable-page/expected/index.html', FIXTURES + 'variable-page/build/index.html');
306
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'variable-page/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
307
            done();
308
        }, 250);
309
    
310
    });
311
312
    it('{{layout}} variable that stores the current layout', function (done) {
313
    
314
        patternlibraryOptions = {
315
            verbose : false,
316
            dest    : FIXTURES + 'variable-layout/build',
317
            root    : FIXTURES + 'variable-layout/pages/',
318
            layouts : FIXTURES + 'variable-layout/layouts/',
319
            partials: FIXTURES + 'variable-layout/partials/',
320
            nogui   : true,
321
            testing : true
322
        };
323
        rimraf.sync(FIXTURES + 'variable-layout/build'); mkdirp(FIXTURES + 'variable-layout/build');
324
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
325
    
326
        p.run();
327
    
328
        setTimeout( function () {
329
            equal(FIXTURES + 'variable-layout/expected/index.html', FIXTURES + 'variable-layout/build/index.html');
330
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'variable-layout/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
331
            done();
332
        }, 250);
333
    
334
    });
335
336
    it('{{root}} variable that stores a relative path to the root folder', function (done) {
337
    
338
        patternlibraryOptions = {
339
            verbose : false,
340
            dest    : FIXTURES + 'variable-root/build',
341
            root    : FIXTURES + 'variable-root/pages/',
342
            layouts : FIXTURES + 'variable-root/layouts/',
343
            partials: FIXTURES + 'variable-root/partials/',
344
            nogui   : true,
345
            testing : true
346
        };
347
        rimraf.sync(FIXTURES + 'variable-root/build'); mkdirp(FIXTURES + 'variable-root/build');
348
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
349
    
350
        p.run();
351
    
352
        setTimeout( function () {
353
            equal(FIXTURES + 'variable-root/expected/index.html', FIXTURES + 'variable-root/build/index.html');
354
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'variable-root/build');
0 ignored issues
show
Coding Style Best Practice introduced by Björn Bartels
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
355
            done();
356
        }, 250);
357
    
358
    });
359
	
360
});
361
362
/*
363
describe('Patternlibrary built-in', () => {
364
365
    it('#code helper that renders code blocks', function (done) {
366
    
367
        patternlibraryOptions = {
368
            verbose : false,
369
            dest    : FIXTURES + 'helper-code/build',
370
            root    : FIXTURES + 'helper-code/pages/',
371
            layouts : FIXTURES + 'helper-code/layouts/',
372
            partials: FIXTURES + 'helper-code/partials/',
373
            nogui   : true,
374
            testing : true
375
        };
376
        rimraf.sync(FIXTURES + 'helper-code/build'); mkdirp(FIXTURES + 'helper-code/build');
377
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
378
    
379
        p.run();
380
    
381
        setTimeout( function () {
382
            equal(FIXTURES + 'helper-code/expected/index.html', FIXTURES + 'helper-code/build/index.html');
383
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'helper-code/build');
384
            done();
385
        }, 250);
386
    
387
    });
388
389
    it('#ifEqual helper that compares two values', function (done) {
390
    
391
        patternlibraryOptions = {
392
            verbose : false,
393
            dest    : FIXTURES + 'helper-ifequal/build',
394
            root    : FIXTURES + 'helper-ifequal/pages/',
395
            layouts : FIXTURES + 'helper-ifequal/layouts/',
396
            partials: FIXTURES + 'helper-ifequal/partials/',
397
            nogui   : true,
398
            testing : true
399
        };
400
        rimraf.sync(FIXTURES + 'helper-ifequal/build'); mkdirp(FIXTURES + 'helper-ifequal/build');
401
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
402
    
403
        p.run();
404
    
405
        setTimeout( function () {
406
            equal(FIXTURES + 'helper-ifequal/expected/index.html', FIXTURES + 'helper-ifequal/build/index.html');
407
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'helper-ifequal/build');
408
            done();
409
        }, 250);
410
    
411
    });
412
413
    it('#markdown helper that converts Markdown to HTML', function (done) {
414
    
415
        patternlibraryOptions = {
416
            verbose : false,
417
            dest    : FIXTURES + 'helper-markdown/build',
418
            root    : FIXTURES + 'helper-markdown/pages/',
419
            layouts : FIXTURES + 'helper-markdown/layouts/',
420
            partials: FIXTURES + 'helper-markdown/partials/',
421
            nogui   : true,
422
            testing : true
423
        };
424
        rimraf.sync(FIXTURES + 'helper-markdown/build'); mkdirp(FIXTURES + 'helper-markdown/build');
425
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
426
    
427
        p.run();
428
    
429
        setTimeout( function () {
430
            equal(FIXTURES + 'helper-markdown/expected/index.html', FIXTURES + 'helper-markdown/build/index.html');
431
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'helper-markdown/build');
432
            done();
433
        }, 250);
434
    
435
    });
436
437
    it('#repeat helper that prints content multiple times', function (done) {
438
    
439
        patternlibraryOptions = {
440
            verbose : false,
441
            dest    : FIXTURES + 'helper-repeat/build',
442
            root    : FIXTURES + 'helper-repeat/pages/',
443
            layouts : FIXTURES + 'helper-repeat/layouts/',
444
            partials: FIXTURES + 'helper-repeat/partials/',
445
            nogui   : true,
446
            testing : true
447
        };
448
        rimraf.sync(FIXTURES + 'helper-repeat/build'); mkdirp(FIXTURES + 'helper-repeat/build');
449
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
450
    
451
        p.run();
452
    
453
        setTimeout( function () {
454
            equal(FIXTURES + 'helper-repeat/expected/index.html', FIXTURES + 'helper-repeat/build/index.html');
455
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'helper-repeat/build');
456
            done();
457
        }, 250);
458
    
459
    });
460
461
    it('#ifpage helper that checks the current page', function (done) {
462
    
463
        patternlibraryOptions = {
464
            verbose : false,
465
            dest    : FIXTURES + 'helper-ifpage/build',
466
            root    : FIXTURES + 'helper-ifpage/pages/',
467
            layouts : FIXTURES + 'helper-ifpage/layouts/',
468
            partials: FIXTURES + 'helper-ifpage/partials/',
469
            nogui   : true,
470
            testing : true
471
        };
472
        rimraf.sync(FIXTURES + 'helper-ifpage/build'); mkdirp(FIXTURES + 'helper-ifpage/build');
473
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
474
    
475
        p.run();
476
    
477
        setTimeout( function () {
478
            equal(FIXTURES + 'helper-ifpage/expected/index.html', FIXTURES + 'helper-ifpage/build/index.html');
479
            equal(FIXTURES + 'helper-ifpage/expected/about.html', FIXTURES + 'helper-ifpage/build/about.html');
480
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'helper-ifpage/build');
481
            done();
482
        }, 250);
483
    
484
    });
485
486
    it('#unlesspage helper that checks the current page', function (done) {
487
    
488
        patternlibraryOptions = {
489
            verbose : false,
490
            dest    : FIXTURES + 'helper-unlesspage/build',
491
            root    : FIXTURES + 'helper-unlesspage/pages/',
492
            layouts : FIXTURES + 'helper-unlesspage/layouts/',
493
            partials: FIXTURES + 'helper-unlesspage/partials/',
494
            nogui   : true,
495
            testing : true
496
        };
497
        rimraf.sync(FIXTURES + 'helper-unlesspage/build'); mkdirp(FIXTURES + 'helper-unlesspage/build');
498
        var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);
499
    
500
        p.run();
501
    
502
        setTimeout( function () {
503
            equal(FIXTURES + 'helper-unlesspage/expected/index.html', FIXTURES + 'helper-unlesspage/build/index.html');
504
            equal(FIXTURES + 'helper-unlesspage/expected/about.html', FIXTURES + 'helper-unlesspage/build/about.html');
505
            if (CLEAN_UP) rimraf.sync(FIXTURES + 'helper-unlesspage/build');
506
            done();
507
        }, 250);
508
    
509
    });
510
	
511
});
512
*/
513