/
test-mode-advanced-custom-official-modules.js
192 lines (159 loc) · 6.28 KB
/
test-mode-advanced-custom-official-modules.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*global describe, beforeEach, it, require */
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;
var assert = require('yeoman-generator').assert;
// TODO Vérifier l'import des modules dans app.js
describe('advanced custom official module', function () {
var gen;
beforeEach(function (done) {
gen = helpers.run(path.join( __dirname, '../app'))
.inDir(path.join( __dirname, 'temp/advanced-custom-official-module'))
.withOptions({'skip-install' : true})
.withArguments([])
.withPrompt({
'mode': 'Advanced',
'name' : "MyApp",
'angular_version' : '2.0.0',
'version' : '0.0.1',
'description' : 'A Great App',
'csslint' : true,
'complexity' : true,
'test' : false,
'revision' : true,
'gitignore' : true,
'i18n' : true,
'csspreprocessor' : 'less',
'tests' : [],
'imagemin' : true,
'modules':[
'resourceModule',
'cookieModule',
'sanitizeModule',
'routeModule',
'touchModule',
'i18nModule',
'animateModule'
]
});
done();
});
it('creates expected files', function (done) {
var expected = [
'.jshintrc',
'.editorconfig',
'.gitignore',
'package.json',
'bower.json',
'.bowerrc',
'README.md',
'Gruntfile.js',
'app/index.html',
'app/css/app.css',
'app/js/controllers/mainController.js',
'app/js/app.js',
'.csslintrc',
'app/less/app.less',
'app/less/style.less'
];
gen.onEnd(function() {
assert.file(expected);
done();
});
});
it("don't create unexpected files", function (done) {
var expected = [
'app/scss/app.scss',
'app/scss/_style.scss'
];
gen.onEnd(function() {
assert.noFile(expected);
done();
});
});
it("package.json content", function (done) {
gen.onEnd(function() {
assert.fileContent('package.json', /"name": "my-app"/);
assert.fileContent('package.json', /"version": "0\.0\.1"/);
assert.fileContent('package.json', /grunt-usemin/);
assert.fileContent('package.json', /grunt-ng-annotate/);
assert.fileContent('package.json', /grunt-contrib-clean/);
assert.fileContent('package.json', /grunt-contrib-concat/);
assert.fileContent('package.json', /grunt-contrib-uglify/);
assert.fileContent('package.json', /grunt-contrib-cssmin/);
assert.fileContent('package.json', /grunt-contrib-watch/);
assert.fileContent('package.json', /grunt-bower-task/);
assert.fileContent('package.json', /grunt-contrib-copy/);
assert.fileContent('package.json', /grunt-contrib-jshint/);
assert.fileContent('package.json', /grunt-rev/);
assert.fileContent('package.json', /grunt-contrib-less/);
assert.fileContent('package.json', /grunt-contrib-csslint/);
assert.fileContent('package.json', /grunt-contrib-imagemin/);
assert.fileContent('package.json', /grunt-plato/);
assert.noFileContent('package.json', /grunt-karma/);
assert.noFileContent('package.json', /karma-ng-html2js-preprocessor/);
assert.noFileContent('package.json', /karma-chrome-launcher/);
assert.noFileContent('package.json', /karma-firefox-launcher/);
assert.noFileContent('package.json', /karma-jasmine/);
assert.noFileContent('package.json', /karma-phantomjs-launcher/);
assert.noFileContent('package.json', /karma/);
assert.noFileContent('package.json', /karma-coverage/);
assert.noFileContent('package.json', /karma-ng-scenario/);
assert.noFileContent('package.json', /grunt-contrib-sass/);
done();
});
});
it("bower.json content", function (done) {
gen.onEnd(function() {
assert.fileContent('bower.json', /"angular": "2\.0\.0"/);
assert.fileContent('bower.json', /"angular-i18n": "2\.0\.0"/);
assert.fileContent('bower.json', /"angular-touch": "2\.0\.0"/);
assert.fileContent('bower.json', /"angular-sanitize": "2\.0\.0"/);
assert.fileContent('bower.json', /"angular-resource": "2\.0\.0"/);
assert.fileContent('bower.json', /"angular-animate": "2\.0\.0"/);
assert.fileContent('bower.json', /"angular-cookies": "2\.0\.0"/);
assert.fileContent('bower.json', /"angular-route": "2\.0\.0"/);
assert.noFileContent('bower.json', /"angular-ui-router"/);
assert.noFileContent('bower.json', /"angular-translate"/);
assert.noFileContent('bower.json', /"angular-snap"/);
assert.noFileContent('bower.json', /"revolunet-angular-carousel"/);
assert.noFileContent('bower.json', /"angular-bindonce"/);
done();
});
});
it("gruntfile.js content", function (done) {
gen.onEnd(function() {
assert.fileContent('Gruntfile.js', /availabletasks/);
assert.fileContent('Gruntfile.js', /wiredep/);
assert.fileContent('Gruntfile.js', /clean/);
assert.fileContent('Gruntfile.js', /copy/);
assert.fileContent('Gruntfile.js', /ngAnnotate/);
assert.fileContent('Gruntfile.js', /useminPrepare/);
assert.fileContent('Gruntfile.js', /usemin/);
assert.fileContent('Gruntfile.js', /browserSync/);
assert.fileContent('Gruntfile.js', /jshint/);
assert.fileContent('Gruntfile.js', /watch/);
assert.fileContent('Gruntfile.js', /rev/);
assert.fileContent('Gruntfile.js', /csslint/);
assert.fileContent('Gruntfile.js', /plato/);
assert.fileContent('Gruntfile.js', /less/);
assert.fileContent('Gruntfile.js', /imagemin/);
assert.fileContent('Gruntfile.js', /htmlmin/);
assert.noFileContent('Gruntfile.js', /karma/);
assert.noFileContent('Gruntfile.js', /sass/);
assert.fileContent('Gruntfile.js', /grunt\.registerTask\('report', \[\s+'plato',\s+'connect:plato'\s+\]\)/);
assert.fileContent('Gruntfile.js', /grunt\.registerTask\('dev', \[\s+'less',\s+'browserSync',\s+'watch'\s+\]\)/);
assert.fileContent('Gruntfile.js', /grunt\.registerTask\('package', \[\s+'jshint',\s+'clean',\s+'useminPrepare',\s+'copy',\s+'concat',\s+'ngAnnotate',\s+'uglify',\s+'less',\s+'cssmin',\s+'rev',\s+'imagemin',\s+'usemin',\s+'htmlmin'\s+\]\)/);
assert.fileContent('Gruntfile.js', /grunt\.registerTask\('ci', \[\s+'package',\s+'plato'\s+\]\)/);
assert.fileContent('Gruntfile.js', /grunt\.registerTask\('ls', \['availabletasks'\]\)/);
done();
});
});
it("app.js content", function (done) {
gen.onEnd(function() {
assert.fileContent('app/js/app.js', /angular\.module\('MyApp'/);
assert.noFileContent('app/js/app.js', /angular\.module\('MyApp'\)\.config\(function\(\$stateProvider, \$urlRouterProvider, \$translateProvider/);
done();
});
});
});