@@ -289,4 +289,47 @@ export class $CLASSNAMEModule {}
289
289
} ) ;
290
290
} ) ;
291
291
} ) ;
292
+
293
+ describe ( 'getDirToWriteToByType' , ( ) => {
294
+ let context : any ;
295
+ const componentsDir = '/path/to/components' ;
296
+ const directivesDir = '/path/to/directives' ;
297
+ const pagesDir = '/path/to/pages' ;
298
+ const pipesDir = '/path/to/pipes' ;
299
+ const providersDir = '/path/to/providers' ;
300
+
301
+ beforeEach ( ( ) => {
302
+ context = {
303
+ componentsDir,
304
+ directivesDir,
305
+ pagesDir,
306
+ pipesDir,
307
+ providersDir,
308
+ } ;
309
+ } ) ;
310
+
311
+ it ( 'should return the appropriate components directory' , ( ) => {
312
+ expect ( util . getDirToWriteToByType ( context , 'component' ) ) . toEqual ( componentsDir ) ;
313
+ } ) ;
314
+
315
+ it ( 'should return the appropriate directives directory' , ( ) => {
316
+ expect ( util . getDirToWriteToByType ( context , 'directive' ) ) . toEqual ( directivesDir ) ;
317
+ } ) ;
318
+
319
+ it ( 'should return the appropriate pages directory' , ( ) => {
320
+ expect ( util . getDirToWriteToByType ( context , 'page' ) ) . toEqual ( pagesDir ) ;
321
+ } ) ;
322
+
323
+ it ( 'should return the appropriate pipes directory' , ( ) => {
324
+ expect ( util . getDirToWriteToByType ( context , 'pipe' ) ) . toEqual ( pipesDir ) ;
325
+ } ) ;
326
+
327
+ it ( 'should return the appropriate providers directory' , ( ) => {
328
+ expect ( util . getDirToWriteToByType ( context , 'provider' ) ) . toEqual ( providersDir ) ;
329
+ } ) ;
330
+
331
+ it ( 'should throw error upon unknown generator type' , ( ) => {
332
+ expect ( ( ) => util . getDirToWriteToByType ( context , 'dan' ) ) . toThrowError ( 'Unknown Generator Type: dan' ) ;
333
+ } ) ;
334
+ } ) ;
292
335
} ) ;
0 commit comments