@@ -73,6 +73,12 @@ describe('Baumeister with default options', () => {
73
73
assert . fileContent ( arg ) ;
74
74
} ) ;
75
75
76
+ it ( 'should not have historyApiFallback in dev server settings' , ( ) => {
77
+ assert . noFileContent ( [
78
+ [ 'build/webpack/config.dev-server.js' , / h i s t o r y A p i F a l l b a c k : t r u e , / ]
79
+ ] ) ;
80
+ } ) ;
81
+
76
82
it ( 'should have `useHandlebars` set to `true` in baumeister.json' , ( ) => {
77
83
assert . fileContent ( 'baumeister.json' , / " u s e H a n d l e b a r s " : t r u e , / ) ;
78
84
} ) ;
@@ -81,6 +87,14 @@ describe('Baumeister with default options', () => {
81
87
assert . fileContent ( 'baumeister.json' , / " g e n e r a t e B a n n e r s " : f a l s e , / ) ;
82
88
} ) ;
83
89
90
+ it ( 'should have the default ProvidePlugin settings in baumeister.json' , ( ) => {
91
+ assert . fileContent ( [
92
+ [ 'baumeister.json' , / " P r o v i d e P l u g i n " : { \n / ] ,
93
+ [ 'baumeister.json' , / " \$ " : " j q u e r y " , / ] ,
94
+ [ 'baumeister.json' , / " j Q u e r y " : " j q u e r y " / ]
95
+ ] ) ;
96
+ } ) ;
97
+
84
98
it ( 'should create package manager files' , ( ) => {
85
99
assert . file ( [
86
100
'package.json'
@@ -104,6 +118,21 @@ describe('Baumeister with default options', () => {
104
118
] ) ;
105
119
} ) ;
106
120
121
+ it ( 'should not have React related plugins in .babelrc' , ( ) => {
122
+ assert . noFileContent ( [
123
+ [ 'src/app/.babelrc' , / t r a n s f o r m - c l a s s - p r o p e r t i e s / ] ,
124
+ [ 'src/app/.babelrc' , / t r a n s f o r m - r e a c t - j s x / ]
125
+ ] ) ;
126
+ } ) ;
127
+
128
+ it ( 'should not have React related settings in .eslintrc' , ( ) => {
129
+ assert . noFileContent ( [
130
+ [ '.eslintrc.json' , / " p l u g i n : r e a c t \/ r e c o m m e n d e d " / ] ,
131
+ [ '.eslintrc.json' , / " p l u g i n s " : \[ " r e a c t " ] ,/ ] ,
132
+ [ '.eslintrc.json' , / " e c m a F e a t u r e s " : { " j s x " : t r u e } / ]
133
+ ] ) ;
134
+ } ) ;
135
+
107
136
it ( 'should have `/dist` directory in .gitignore' , ( ) => {
108
137
assert . fileContent ( [
109
138
[ '.gitignore' , / d i s t / ]
@@ -122,6 +151,14 @@ describe('Baumeister with default options', () => {
122
151
] ) ;
123
152
} ) ;
124
153
154
+ it ( 'should not create html files' , ( ) => {
155
+ assert . noFile ( [
156
+ 'src/index.html' ,
157
+ 'src/stickyFooter.html' ,
158
+ 'src/demoElements.html'
159
+ ] ) ;
160
+ } ) ;
161
+
125
162
it ( 'should create other project files' , ( ) => {
126
163
assert . file ( [
127
164
'README.md' ,
@@ -135,14 +172,33 @@ describe('Baumeister with default options', () => {
135
172
] ) ;
136
173
} ) ;
137
174
175
+ it ( 'should create JS file ' , ( ) => {
176
+ assert . file ( [
177
+ 'src/app/base/base.js' ,
178
+ 'src/app/index.js' ,
179
+ 'src/app/base/polyfills.js'
180
+ ] ) ;
181
+ } ) ;
182
+
183
+ it ( 'should import Bootstrap in index.js' , ( ) => {
184
+ assert . fileContent ( [
185
+ [ 'src/app/index.js' , / i m p o r t ' b o o t s t r a p ' ; / ]
186
+ ] ) ;
187
+ } ) ;
188
+
189
+ it ( 'should not use React in index.js' , ( ) => {
190
+ assert . noFileContent ( [
191
+ [ 'src/app/index.js' , / i m p o r t R e a c t f r o m ' r e a c t ' ; / ] ,
192
+ [ 'src/app/index.js' , / i m p o r t R e a c t D O M f r o m ' r e a c t - d o m ' ; / ] ,
193
+ [ 'src/app/index.js' , / R e a c t D O M \. r e n d e r / ]
194
+ ] ) ;
195
+ } ) ;
196
+
138
197
it ( 'should create assets' , ( ) => {
139
198
assert . file ( [
140
199
'src/assets' ,
141
200
'src/assets/fonts' ,
142
201
'src/assets/img' ,
143
- 'src/app/base/base.js' ,
144
- 'src/app/index.js' ,
145
- 'src/app/base/polyfills.js' ,
146
202
'src/assets/scss/index.scss' ,
147
203
'src/assets/scss/_print.scss' ,
148
204
'src/assets/scss/_' + _s . slugify ( prompts . theme ) + '.scss' ,
@@ -165,7 +221,7 @@ describe('Baumeister with default options', () => {
165
221
] ) ;
166
222
} ) ;
167
223
168
- it ( 'should import ` _variables.scss` within ` index.scss` file' , ( ) => {
224
+ it ( 'should import \' _variables.scss\' within \' index.scss\' file' , ( ) => {
169
225
assert . fileContent ( [
170
226
[ 'src/assets/scss/index.scss' , / .\/ v a r i a b l e s / ]
171
227
] ) ;
@@ -182,6 +238,31 @@ describe('Baumeister with default options', () => {
182
238
packageJson . should . have . property ( 'description' , prompts . projectDescription ) ;
183
239
} ) ;
184
240
241
+ describe ( 'Dependencies' , ( ) => {
242
+ it ( 'should have jQuery and popper.js' , ( ) => {
243
+ assert . fileContent ( [
244
+ [ 'package.json' , / j q u e r y / ] ,
245
+ [ 'package.json' , / p o p p e r .j s / ]
246
+ ] ) ;
247
+ } ) ;
248
+
249
+ it ( 'should not have React and related dependencies' , ( ) => {
250
+ assert . noFileContent ( [
251
+ [ 'package.json' , / r e a c t / ] ,
252
+ [ 'package.json' , / r e a c t - d o m / ] ,
253
+ [ 'package.json' , / p r o p - t y p e s / ]
254
+ ] ) ;
255
+ } ) ;
256
+
257
+ it ( 'should not have React related dev dependencies' , ( ) => {
258
+ assert . noFileContent ( [
259
+ [ 'package.json' , / e s l i n t - p l u g i n - r e a c t / ] ,
260
+ [ 'package.json' , / b a b e l - p l u g i n - t r a n s f o r m - r e a c t - j s x / ] ,
261
+ [ 'package.json' , / b a b e l - p l u g i n - t r a n s f o r m - c l a s s - p r o p e r t i e s / ]
262
+ ] ) ;
263
+ } ) ;
264
+ } ) ;
265
+
185
266
it ( 'should render project name and description in README.md' , ( ) => {
186
267
let regex = new RegExp ( escapeStringRegexp ( prompts . projectDescription ) , '' ) ;
187
268
assert . fileContent ( 'README.md' , regex ) ;
@@ -258,7 +339,7 @@ describe('Baumeister with default options', () => {
258
339
259
340
} ) ;
260
341
261
- describe ( 'Baumeister with Handlebars disabled ' , ( ) => {
342
+ describe ( 'Baumeister generating a single page app ' , ( ) => {
262
343
// Define prompt answers
263
344
const prompts = {
264
345
projectName : 'Test this Thingy' ,
@@ -296,8 +377,11 @@ describe('Baumeister with Handlebars disabled', () => {
296
377
. toPromise ( ) ;
297
378
} ) ;
298
379
299
- it ( 'should have `useHandlebars` set to `false` in baumeister.json' , ( ) => {
300
- assert . fileContent ( 'baumeister.json' , / " u s e H a n d l e b a r s " : f a l s e , / ) ;
380
+ it ( 'should have adapted settings in baumeister.json' , ( ) => {
381
+ assert . fileContent ( [
382
+ [ 'baumeister.json' , / " u s e H a n d l e b a r s " : f a l s e , / ] ,
383
+ [ 'baumeister.json' , / " P r o v i d e P l u g i n " : { } / ]
384
+ ] ) ;
301
385
} ) ;
302
386
303
387
it ( 'should create no Handlebars related files' , ( ) => {
@@ -307,13 +391,93 @@ describe('Baumeister with Handlebars disabled', () => {
307
391
] ) ;
308
392
} ) ;
309
393
310
- it ( 'should create example html files' , ( ) => {
394
+ it ( 'should create just the essential html files' , ( ) => {
311
395
assert . file ( [
312
- 'src/index.html' ,
396
+ 'src/index.html'
397
+ ] ) ;
398
+ assert . noFile ( [
313
399
'src/stickyFooter.html' ,
314
400
'src/demoElements.html'
315
401
] ) ;
316
402
} ) ;
403
+
404
+ it ( 'should have an additional container in index.html' , ( ) => {
405
+ assert . fileContent ( [
406
+ [ 'src/index.html' , / < d i v i d = " r o o t " \/ > / ]
407
+ ] ) ;
408
+ } ) ;
409
+
410
+ it ( 'should have a base element in index.html' , ( ) => {
411
+ assert . fileContent ( [
412
+ [ 'src/index.html' , / < b a s e h r e f = " \/ " > / ]
413
+ ] ) ;
414
+ } ) ;
415
+
416
+ it ( 'should not include navigation in index.html' , ( ) => {
417
+ assert . noFileContent ( [
418
+ [ 'src/index.html' , / r o l e = " n a v i g a t i o n " / ]
419
+ ] ) ;
420
+ } ) ;
421
+
422
+ describe ( 'Dependencies' , ( ) => {
423
+ it ( 'should not have jQuery and popper.js' , ( ) => {
424
+ assert . noFileContent ( [
425
+ [ 'package.json' , / j q u e r y / ] ,
426
+ [ 'package.json' , / p o p p e r .j s / ]
427
+ ] ) ;
428
+ } ) ;
429
+
430
+ it ( 'should have React and related dependencies' , ( ) => {
431
+ assert . fileContent ( [
432
+ [ 'package.json' , / r e a c t / ] ,
433
+ [ 'package.json' , / r e a c t - d o m / ] ,
434
+ [ 'package.json' , / p r o p - t y p e s / ]
435
+ ] ) ;
436
+ } ) ;
437
+
438
+ it ( 'should have React related dev dependencies' , ( ) => {
439
+ assert . fileContent ( [
440
+ [ 'package.json' , / e s l i n t - p l u g i n - r e a c t / ] ,
441
+ [ 'package.json' , / b a b e l - p l u g i n - t r a n s f o r m - r e a c t - j s x / ] ,
442
+ [ 'package.json' , / b a b e l - p l u g i n - t r a n s f o r m - c l a s s - p r o p e r t i e s / ]
443
+ ] ) ;
444
+ } ) ;
445
+ } ) ;
446
+
447
+ it ( 'should have React related plugins in .babelrc' , ( ) => {
448
+ assert . fileContent ( [
449
+ [ 'src/app/.babelrc' , / t r a n s f o r m - c l a s s - p r o p e r t i e s / ] ,
450
+ [ 'src/app/.babelrc' , / t r a n s f o r m - r e a c t - j s x / ]
451
+ ] ) ;
452
+ } ) ;
453
+
454
+ it ( 'should have React related settings in .eslintrc' , ( ) => {
455
+ assert . fileContent ( [
456
+ [ '.eslintrc.json' , / " p l u g i n : r e a c t \/ r e c o m m e n d e d " / ] ,
457
+ [ '.eslintrc.json' , / " p l u g i n s " : \[ " r e a c t " ] ,/ ] ,
458
+ [ '.eslintrc.json' , / " e c m a F e a t u r e s " : { " j s x " : t r u e } / ]
459
+ ] ) ;
460
+ } ) ;
461
+
462
+ it ( 'should have historyApiFallback in dev server settings' , ( ) => {
463
+ assert . fileContent ( [
464
+ [ 'build/webpack/config.dev-server.js' , / h i s t o r y A p i F a l l b a c k : t r u e , / ]
465
+ ] ) ;
466
+ } ) ;
467
+
468
+ it ( 'should not import Bootstrap in index.js' , ( ) => {
469
+ assert . noFileContent ( [
470
+ [ 'src/app/index.js' , / i m p o r t ' b o o t s t r a p ' ; / ]
471
+ ] ) ;
472
+ } ) ;
473
+
474
+ it ( 'should use React in index.js' , ( ) => {
475
+ assert . fileContent ( [
476
+ [ 'src/app/index.js' , / i m p o r t R e a c t f r o m ' r e a c t ' ; / ] ,
477
+ [ 'src/app/index.js' , / i m p o r t R e a c t D O M f r o m ' r e a c t - d o m ' ; / ] ,
478
+ [ 'src/app/index.js' , / R e a c t D O M \. r e n d e r / ]
479
+ ] ) ;
480
+ } ) ;
317
481
} ) ;
318
482
319
483
describe ( 'Baumeister with banner' , ( ) => {
@@ -554,7 +718,7 @@ describe('Baumeister with GNU General Public License', () => {
554
718
555
719
} ) ;
556
720
557
- describe ( 'Baumeister with less boilerplate code and handlebars enabled ' , ( ) => {
721
+ describe ( 'Baumeister with less boilerplate code as static website ' , ( ) => {
558
722
559
723
// Define prompt answers
560
724
const prompts = {
@@ -633,7 +797,7 @@ describe('Baumeister with less boilerplate code and handlebars enabled', () => {
633
797
} ) ;
634
798
} ) ;
635
799
636
- describe ( 'Baumeister with less boilerplate code and handlebars disabled ' , ( ) => {
800
+ describe ( 'Baumeister with less boilerplate code as single page app ' , ( ) => {
637
801
638
802
// Define prompt answers
639
803
const prompts = {
@@ -854,7 +1018,7 @@ describe('Baumeister using --yo-rc flag', () => {
854
1018
] ) ;
855
1019
} ) ;
856
1020
857
- it ( 'should import ` _variables.scss` within ` index.scss` file' , ( ) => {
1021
+ it ( 'should import \' _variables.scss\' within \' index.scss\' file' , ( ) => {
858
1022
assert . fileContent ( [
859
1023
[ 'src/assets/scss/index.scss' , / .\/ v a r i a b l e s / ]
860
1024
] ) ;
0 commit comments