@@ -49,33 +49,33 @@ describe('Module Schematic', () => {
4949
5050 const tree = await schematicRunner . runSchematic ( 'module' , options , appTree ) ;
5151 const files = tree . files ;
52- expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo. module.ts' ) ;
52+ expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo- module.ts' ) ;
5353 } ) ;
5454
5555 it ( 'should import into another module' , async ( ) => {
56- const options = { ...defaultOptions , module : 'app. module.ts' } ;
56+ const options = { ...defaultOptions , module : 'app- module.ts' } ;
5757
5858 const tree = await schematicRunner . runSchematic ( 'module' , options , appTree ) ;
59- const content = tree . readContent ( '/projects/bar/src/app/app. module.ts' ) ;
60- expect ( content ) . toMatch ( / i m p o r t { F o o M o d u l e } f r o m ' .\/ f o o \/ f o o . m o d u l e ' / ) ;
59+ const content = tree . readContent ( '/projects/bar/src/app/app- module.ts' ) ;
60+ expect ( content ) . toMatch ( / i m p o r t { F o o M o d u l e } f r o m ' .\/ f o o \/ f o o - m o d u l e ' / ) ;
6161 expect ( content ) . toMatch ( / i m p o r t s : \[ [ ^ \] ] * F o o M o d u l e [ ^ \] ] * \] / m) ;
6262 } ) ;
6363
6464 it ( 'should import into another module when using flat' , async ( ) => {
65- const options = { ...defaultOptions , flat : true , module : 'app. module.ts' } ;
65+ const options = { ...defaultOptions , flat : true , module : 'app- module.ts' } ;
6666
6767 const tree = await schematicRunner . runSchematic ( 'module' , options , appTree ) ;
68- const content = tree . readContent ( '/projects/bar/src/app/app. module.ts' ) ;
69- expect ( content ) . toMatch ( / i m p o r t { F o o M o d u l e } f r o m ' .\/ f o o . m o d u l e ' / ) ;
68+ const content = tree . readContent ( '/projects/bar/src/app/app- module.ts' ) ;
69+ expect ( content ) . toMatch ( / i m p o r t { F o o M o d u l e } f r o m ' .\/ f o o - m o d u l e ' / ) ;
7070 expect ( content ) . toMatch ( / i m p o r t s : \[ [ ^ \] ] * F o o M o d u l e [ ^ \] ] * \] / m) ;
7171 } ) ;
7272
7373 it ( 'should import into another module when using flat' , async ( ) => {
74- const options = { ...defaultOptions , flat : true , module : 'app. module.ts' } ;
74+ const options = { ...defaultOptions , flat : true , module : 'app- module.ts' } ;
7575
7676 const tree = await schematicRunner . runSchematic ( 'module' , options , appTree ) ;
77- const content = tree . readContent ( '/projects/bar/src/app/app. module.ts' ) ;
78- expect ( content ) . toMatch ( / i m p o r t { F o o M o d u l e } f r o m ' .\/ f o o . m o d u l e ' / ) ;
77+ const content = tree . readContent ( '/projects/bar/src/app/app- module.ts' ) ;
78+ expect ( content ) . toMatch ( / i m p o r t { F o o M o d u l e } f r o m ' .\/ f o o - m o d u l e ' / ) ;
7979 expect ( content ) . toMatch ( / i m p o r t s : \[ [ ^ \] ] * F o o M o d u l e [ ^ \] ] * \] / m) ;
8080 } ) ;
8181
@@ -102,21 +102,21 @@ describe('Module Schematic', () => {
102102 tree ,
103103 ) ;
104104
105- const content = tree . readContent ( '/projects/bar/src/app/sub1/test1/test1. module.ts' ) ;
106- expect ( content ) . toMatch ( / i m p o r t { T e s t 2 M o d u l e } f r o m ' ..\/ ..\/ s u b 2 \/ t e s t 2 \/ t e s t 2 . m o d u l e ' / ) ;
105+ const content = tree . readContent ( '/projects/bar/src/app/sub1/test1/test1- module.ts' ) ;
106+ expect ( content ) . toMatch ( / i m p o r t { T e s t 2 M o d u l e } f r o m ' ..\/ ..\/ s u b 2 \/ t e s t 2 \/ t e s t 2 - m o d u l e ' / ) ;
107107 } ) ;
108108
109109 it ( 'should create a routing module' , async ( ) => {
110110 const options = { ...defaultOptions , routing : true } ;
111111
112112 const tree = await schematicRunner . runSchematic ( 'module' , options , appTree ) ;
113113 const files = tree . files ;
114- expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo. module.ts' ) ;
115- expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo-routing. module.ts' ) ;
116- const moduleContent = tree . readContent ( '/projects/bar/src/app/foo/foo. module.ts' ) ;
117- expect ( moduleContent ) . toMatch ( / i m p o r t { F o o R o u t i n g M o d u l e } f r o m ' .\/ f o o - r o u t i n g . m o d u l e ' / ) ;
114+ expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo- module.ts' ) ;
115+ expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo-routing- module.ts' ) ;
116+ const moduleContent = tree . readContent ( '/projects/bar/src/app/foo/foo- module.ts' ) ;
117+ expect ( moduleContent ) . toMatch ( / i m p o r t { F o o R o u t i n g M o d u l e } f r o m ' .\/ f o o - r o u t i n g - m o d u l e ' / ) ;
118118 const routingModuleContent = tree . readContent (
119- '/projects/bar/src/app/foo/foo-routing. module.ts' ,
119+ '/projects/bar/src/app/foo/foo-routing- module.ts' ,
120120 ) ;
121121 expect ( routingModuleContent ) . toMatch ( / R o u t e r M o d u l e .f o r C h i l d \( r o u t e s \) / ) ;
122122 } ) ;
@@ -126,15 +126,15 @@ describe('Module Schematic', () => {
126126
127127 const tree = await schematicRunner . runSchematic ( 'module' , options , appTree ) ;
128128 const files = tree . files ;
129- expect ( files ) . toContain ( '/projects/bar/src/app/two-word/two-word. module.ts' ) ;
129+ expect ( files ) . toContain ( '/projects/bar/src/app/two-word/two-word- module.ts' ) ;
130130 } ) ;
131131
132132 it ( 'should respect the sourceRoot value' , async ( ) => {
133133 const config = JSON . parse ( appTree . readContent ( '/angular.json' ) ) ;
134134 config . projects . bar . sourceRoot = 'projects/bar/custom' ;
135135 appTree . overwrite ( '/angular.json' , JSON . stringify ( config , null , 2 ) ) ;
136136 appTree = await schematicRunner . runSchematic ( 'module' , defaultOptions , appTree ) ;
137- expect ( appTree . files ) . toContain ( '/projects/bar/custom/app/foo/foo. module.ts' ) ;
137+ expect ( appTree . files ) . toContain ( '/projects/bar/custom/app/foo/foo- module.ts' ) ;
138138 } ) ;
139139
140140 describe ( 'lazy route generator' , ( ) => {
@@ -150,23 +150,23 @@ describe('Module Schematic', () => {
150150
151151 expect ( files ) . toEqual (
152152 jasmine . arrayContaining ( [
153- '/projects/bar/src/app/foo/foo. module.ts' ,
154- '/projects/bar/src/app/foo/foo-routing. module.ts' ,
153+ '/projects/bar/src/app/foo/foo- module.ts' ,
154+ '/projects/bar/src/app/foo/foo-routing- module.ts' ,
155155 '/projects/bar/src/app/foo/foo.ts' ,
156156 '/projects/bar/src/app/foo/foo.ng.html' ,
157157 '/projects/bar/src/app/foo/foo.css' ,
158158 ] ) ,
159159 ) ;
160160
161161 const appRoutingModuleContent = tree . readContent (
162- '/projects/bar/src/app/app-routing. module.ts' ,
162+ '/projects/bar/src/app/app-routing- module.ts' ,
163163 ) ;
164164 expect ( appRoutingModuleContent ) . toMatch (
165- / p a t h : ' \/ n e w - r o u t e ' , l o a d C h i l d r e n : \( \) = > i m p o r t \( ' .\/ f o o \/ f o o . m o d u l e ' \) .t h e n \( m = > m .F o o M o d u l e \) / ,
165+ / p a t h : ' \/ n e w - r o u t e ' , l o a d C h i l d r e n : \( \) = > i m p o r t \( ' .\/ f o o \/ f o o - m o d u l e ' \) .t h e n \( m = > m .F o o M o d u l e \) / ,
166166 ) ;
167167
168168 const fooRoutingModuleContent = tree . readContent (
169- '/projects/bar/src/app/foo/foo-routing. module.ts' ,
169+ '/projects/bar/src/app/foo/foo-routing- module.ts' ,
170170 ) ;
171171 expect ( fooRoutingModuleContent ) . toMatch ( / R o u t e r M o d u l e .f o r C h i l d \( r o u t e s \) / ) ;
172172 expect ( fooRoutingModuleContent ) . toMatch (
@@ -176,7 +176,7 @@ describe('Module Schematic', () => {
176176
177177 it ( 'should generate a lazy loaded module with embedded route declarations' , async ( ) => {
178178 appTree . overwrite (
179- '/projects/bar/src/app/app. module.ts' ,
179+ '/projects/bar/src/app/app- module.ts' ,
180180 `
181181 import { NgModule } from '@angular/core';
182182 import { AppComponent } from './app';
@@ -195,23 +195,23 @@ describe('Module Schematic', () => {
195195 export class AppModule { }
196196 ` ,
197197 ) ;
198- appTree . delete ( '/projects/bar/src/app/app-routing. module.ts' ) ;
198+ appTree . delete ( '/projects/bar/src/app/app-routing- module.ts' ) ;
199199
200200 const tree = await schematicRunner . runSchematic ( 'module' , options , appTree ) ;
201201 const files = tree . files ;
202202
203- expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo. module.ts' ) ;
204- expect ( files ) . not . toContain ( '/projects/bar/src/app/foo/foo-routing. module.ts' ) ;
203+ expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo- module.ts' ) ;
204+ expect ( files ) . not . toContain ( '/projects/bar/src/app/foo/foo-routing- module.ts' ) ;
205205 expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo.ts' ) ;
206206 expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo.ng.html' ) ;
207207 expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo.css' ) ;
208208
209- const appModuleContent = tree . readContent ( '/projects/bar/src/app/app. module.ts' ) ;
209+ const appModuleContent = tree . readContent ( '/projects/bar/src/app/app- module.ts' ) ;
210210 expect ( appModuleContent ) . toMatch (
211- / p a t h : ' \/ n e w - r o u t e ' , l o a d C h i l d r e n : \( \) = > i m p o r t \( ' .\/ f o o \/ f o o . m o d u l e ' \) .t h e n \( m = > m .F o o M o d u l e \) / ,
211+ / p a t h : ' \/ n e w - r o u t e ' , l o a d C h i l d r e n : \( \) = > i m p o r t \( ' .\/ f o o \/ f o o - m o d u l e ' \) .t h e n \( m = > m .F o o M o d u l e \) / ,
212212 ) ;
213213
214- const fooModuleContent = tree . readContent ( '/projects/bar/src/app/foo/foo. module.ts' ) ;
214+ const fooModuleContent = tree . readContent ( '/projects/bar/src/app/foo/foo- module.ts' ) ;
215215 expect ( fooModuleContent ) . toMatch ( / R o u t e r M o d u l e .f o r C h i l d \( r o u t e s \) / ) ;
216216 expect ( fooModuleContent ) . toMatch (
217217 / c o n s t r o u t e s : R o u t e s = \[ \r ? \n ? \s * { p a t h : ' ' , c o m p o n e n t : F o o } \r ? \n ? \s * \] ; / ,
@@ -228,19 +228,19 @@ describe('Module Schematic', () => {
228228
229229 expect ( files ) . toEqual (
230230 jasmine . arrayContaining ( [
231- '/projects/bar/src/app/foo. module.ts' ,
232- '/projects/bar/src/app/foo-routing. module.ts' ,
231+ '/projects/bar/src/app/foo- module.ts' ,
232+ '/projects/bar/src/app/foo-routing- module.ts' ,
233233 '/projects/bar/src/app/foo.ts' ,
234234 '/projects/bar/src/app/foo.ng.html' ,
235235 '/projects/bar/src/app/foo.css' ,
236236 ] ) ,
237237 ) ;
238238
239239 const appRoutingModuleContent = tree . readContent (
240- '/projects/bar/src/app/app-routing. module.ts' ,
240+ '/projects/bar/src/app/app-routing- module.ts' ,
241241 ) ;
242242 expect ( appRoutingModuleContent ) . toMatch (
243- / p a t h : ' \/ n e w - r o u t e ' , l o a d C h i l d r e n : \( \) = > i m p o r t \( ' .\/ f o o . m o d u l e ' \) .t h e n \( m = > m .F o o M o d u l e \) / ,
243+ / p a t h : ' \/ n e w - r o u t e ' , l o a d C h i l d r e n : \( \) = > i m p o r t \( ' .\/ f o o - m o d u l e ' \) .t h e n \( m = > m .F o o M o d u l e \) / ,
244244 ) ;
245245 } ) ;
246246
@@ -267,34 +267,34 @@ describe('Module Schematic', () => {
267267 ) ;
268268 expect ( tree . files ) . toEqual (
269269 jasmine . arrayContaining ( [
270- '/projects/bar/src/app/foo/foo-routing. module.ts' ,
271- '/projects/bar/src/app/foo/foo. module.ts' ,
272- '/projects/bar/src/app/bar/bar-routing. module.ts' ,
273- '/projects/bar/src/app/bar/bar. module.ts' ,
270+ '/projects/bar/src/app/foo/foo-routing- module.ts' ,
271+ '/projects/bar/src/app/foo/foo- module.ts' ,
272+ '/projects/bar/src/app/bar/bar-routing- module.ts' ,
273+ '/projects/bar/src/app/bar/bar- module.ts' ,
274274 '/projects/bar/src/app/bar/bar.ts' ,
275275 ] ) ,
276276 ) ;
277277
278278 const barRoutingModuleContent = tree . readContent (
279- '/projects/bar/src/app/bar/bar-routing. module.ts' ,
279+ '/projects/bar/src/app/bar/bar-routing- module.ts' ,
280280 ) ;
281281 expect ( barRoutingModuleContent ) . toContain ( `path: '', component: Bar ` ) ;
282282
283283 const fooRoutingModuleContent = tree . readContent (
284- '/projects/bar/src/app/foo/foo-routing. module.ts' ,
284+ '/projects/bar/src/app/foo/foo-routing- module.ts' ,
285285 ) ;
286286 expect ( fooRoutingModuleContent ) . toContain (
287- `loadChildren: () => import('../bar/bar. module').then(m => m.BarModule)` ,
287+ `loadChildren: () => import('../bar/bar- module').then(m => m.BarModule)` ,
288288 ) ;
289289 } ) ;
290290
291291 it ( 'should not add reference to RouterModule when referencing lazy routing module' , async ( ) => {
292292 // Delete routing module
293- appTree . delete ( '/projects/bar/src/app/app-routing. module.ts' ) ;
293+ appTree . delete ( '/projects/bar/src/app/app-routing- module.ts' ) ;
294294
295- // Update app. module to contain the route config.
295+ // Update app- module to contain the route config.
296296 appTree . overwrite (
297- 'projects/bar/src/app/app. module.ts' ,
297+ 'projects/bar/src/app/app- module.ts' ,
298298 `
299299 import { NgModule } from '@angular/core';
300300 import { RouterModule } from '@angular/router';
@@ -317,11 +317,11 @@ describe('Module Schematic', () => {
317317 name : 'bar' ,
318318 route : 'bar' ,
319319 routing : true ,
320- module : 'app. module.ts' ,
320+ module : 'app- module.ts' ,
321321 } ,
322322 appTree ,
323323 ) ;
324- const content = tree . readContent ( '/projects/bar/src/app/bar/bar. module.ts' ) ;
324+ const content = tree . readContent ( '/projects/bar/src/app/bar/bar- module.ts' ) ;
325325 expect ( content ) . toContain ( 'RouterModule.forChild(routes)' ) ;
326326 expect ( content ) . not . toContain ( 'BarRoutingModule' ) ;
327327 } ) ;
0 commit comments