2
2
3
3
const ng = require ( '../helpers/ng' ) ;
4
4
const tmp = require ( '../helpers/tmp' ) ;
5
+ var fs = require ( 'fs-extra' ) ;
6
+
5
7
6
8
const existsSync = require ( 'exists-sync' ) ;
7
9
const expect = require ( 'chai' ) . expect ;
@@ -36,6 +38,7 @@ describe('Acceptance: ng generate module', function () {
36
38
expect ( existsSync ( path . join ( testPath , 'my-module' , 'my-module.module.ts' ) ) ) . to . equal ( true ) ;
37
39
expect ( existsSync ( path . join ( testPath , 'my-module' , 'my-module.module.spec.ts' ) ) ) . to . equal ( false ) ;
38
40
expect ( existsSync ( path . join ( testPath , 'my-module' , 'my-module.component.ts' ) ) ) . to . equal ( false ) ;
41
+
39
42
} ) ;
40
43
} ) ;
41
44
@@ -55,6 +58,15 @@ describe('Acceptance: ng generate module', function () {
55
58
} ) ;
56
59
} ) ;
57
60
61
+ it ( 'ng generate module my-module --prefix=my' , function ( ) {
62
+ return ng ( [ 'generate' , 'module' , 'my-module' , '--prefix=my' ] ) . then ( ( ) => {
63
+ expect ( existsSync ( path . join ( testPath , 'my-module' , 'my-module.module.ts' ) ) ) . to . equal ( true ) ;
64
+ var contents = fs . readFileSync ( path . join ( testPath , 'my-module' , 'my-module.module.ts' ) , 'utf8' ) ;
65
+ expect ( contents . indexOf ( 'export const ModulePrefix = \'my\';' ) === - 1 ) . to . equal ( false ) ;
66
+ expect ( existsSync ( path . join ( testPath , 'my-module' , 'my-module.module.spec.ts' ) ) ) . to . equal ( false ) ;
67
+ expect ( existsSync ( path . join ( testPath , 'my-module' , 'my-module.component.ts' ) ) ) . to . equal ( false ) ; } ) ;
68
+ } ) ;
69
+
58
70
it ( 'ng generate module TwoWord' , function ( ) {
59
71
return ng ( [ 'generate' , 'module' , 'TwoWord' ] ) . then ( ( ) => {
60
72
expect ( existsSync ( path . join ( testPath , 'two-word' , 'two-word.module.ts' ) ) ) . to . equal ( true ) ;
0 commit comments