@@ -86,7 +86,9 @@ var expected = [
86
86
87
87
] ;
88
88
89
- describe ( 'init generator' , function ( ) {
89
+
90
+ // ---- Main generator
91
+ describe ( 'main generator' , function ( ) {
90
92
91
93
beforeEach ( function ( done ) {
92
94
helpers . testDirectory ( path . join ( __dirname , 'temp' ) , function ( err ) {
@@ -166,3 +168,100 @@ describe('init generator', function () {
166
168
} ) ;
167
169
168
170
} ) ;
171
+
172
+ // ---- Page sub-generator
173
+
174
+ describe ( 'page sub-generator' , function ( ) {
175
+ beforeEach ( function ( done ) {
176
+ helpers . testDirectory ( path . join ( __dirname , 'temp' ) , function ( err ) {
177
+ if ( err ) {
178
+ return done ( err ) ;
179
+ }
180
+
181
+ this . app = helpers . createGenerator ( 'init:page' , [
182
+ '../../page'
183
+ ] , [ 'test-page' ] ) ;
184
+ done ( ) ;
185
+ } . bind ( this ) ) ;
186
+ } ) ;
187
+
188
+ it ( 'creates expected files for the page sub-generator' , function ( done ) {
189
+
190
+ var expected = [
191
+ 'templates/test-page.html'
192
+ ] ;
193
+
194
+ this . app . options [ 'skip-install' ] = true ;
195
+ this . app . run ( { } , function ( ) {
196
+ helpers . assertFiles ( expected ) ;
197
+ done ( ) ;
198
+ } ) ;
199
+
200
+ } ) ;
201
+
202
+ } ) ;
203
+
204
+ // ---- Module sub-generator
205
+
206
+ describe ( 'module sub-generator' , function ( ) {
207
+ beforeEach ( function ( done ) {
208
+ helpers . testDirectory ( path . join ( __dirname , 'temp' ) , function ( err ) {
209
+ if ( err ) {
210
+ return done ( err ) ;
211
+ }
212
+
213
+ this . app = helpers . createGenerator ( 'init:module' , [
214
+ '../../module'
215
+ ] , [ 'test' ] ) ;
216
+ done ( ) ;
217
+ } . bind ( this ) ) ;
218
+ } ) ;
219
+
220
+ it ( 'creates expected files for the module sub-generator' , function ( done ) {
221
+
222
+ var expected = [
223
+ 'js/modules/test.js' ,
224
+ 'test/specs/test.spec.js'
225
+ ] ;
226
+
227
+ this . app . options [ 'skip-install' ] = true ;
228
+ this . app . run ( { } , function ( ) {
229
+ helpers . assertFiles ( expected ) ;
230
+ done ( ) ;
231
+ } ) ;
232
+
233
+ } ) ;
234
+
235
+ } ) ;
236
+
237
+ // ---- Jqueryplugin sub-generator
238
+
239
+ describe ( 'jqueryplugin sub-generator' , function ( ) {
240
+ beforeEach ( function ( done ) {
241
+ helpers . testDirectory ( path . join ( __dirname , 'temp' ) , function ( err ) {
242
+ if ( err ) {
243
+ return done ( err ) ;
244
+ }
245
+
246
+ this . app = helpers . createGenerator ( 'init:jqueryplugin' , [
247
+ '../../jqueryplugin'
248
+ ] , [ 'test' ] ) ;
249
+ done ( ) ;
250
+ } . bind ( this ) ) ;
251
+ } ) ;
252
+
253
+ it ( 'creates expected files for the jqueryplugin sub-generator' , function ( done ) {
254
+
255
+ var expected = [
256
+ 'js/plugins/jquery.test.js'
257
+ ] ;
258
+
259
+ this . app . options [ 'skip-install' ] = true ;
260
+ this . app . run ( { } , function ( ) {
261
+ helpers . assertFiles ( expected ) ;
262
+ done ( ) ;
263
+ } ) ;
264
+
265
+ } ) ;
266
+
267
+ } ) ;
0 commit comments