-
Notifications
You must be signed in to change notification settings - Fork 7
/
htmlminOptionsParser.spec.js
54 lines (46 loc) · 1.04 KB
/
htmlminOptionsParser.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'use strict';
var htmlminOptionsParser = require('../lib/htmlminOptionsParser');
var expect = require('chai').expect;
var htmlmin = '--htmlmin-';
describe('htmlminOptionsParser.spec.js', function() {
it('should parse htmlmin options', function () {
//given
var rawArgs = [
'--output',
'--no-new-module',
'--no-strict',
htmlmin + 'minifyCSS',
htmlmin + 'minifyJS',
htmlmin + 'anyOtherOption'
];
//when
var result = htmlminOptionsParser(rawArgs);
//then
expect(result).to.eql({
minifyCSS: true,
minifyJS: true,
anyOtherOption: true
});
});
it('should flip values for flags prefixed with no-', function() {
//given
var rawArgs = [
'--output',
'--no-new-module',
'--no-strict',
htmlmin + 'no-html5',
htmlmin + 'no-includeAutoGeneratedTags',
htmlmin + 'minifyJS',
htmlmin + 'minifyCSS'
];
//when
var result = htmlminOptionsParser(rawArgs);
//then
expect(result).to.eql({
html5: false,
includeAutoGeneratedTags: false,
minifyJS: true,
minifyCSS: true
});
});
});