@@ -56,6 +56,25 @@ describe('Pipe Schematic', () => {
5656 it ( 'should create a pipe' , async ( ) => {
5757 const tree = await schematicRunner . runSchematic ( 'pipe' , defaultNonStandaloneOptions , appTree ) ;
5858 const files = tree . files ;
59+ expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.spec.ts' ) ;
60+ expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.ts' ) ;
61+ const moduleContent = getFileContent ( tree , '/projects/bar/src/app/app.module.ts' ) ;
62+ expect ( moduleContent ) . toMatch ( / i m p o r t .* F o o .* f r o m ' .\/ f o o - p i p e ' / ) ;
63+ expect ( moduleContent ) . toMatch ( / d e c l a r a t i o n s : \s * \[ [ ^ \] ] + ?, \r ? \n \s + F o o P i p e \r ? \n / m) ;
64+ const fileContent = tree . readContent ( '/projects/bar/src/app/foo-pipe.ts' ) ;
65+ expect ( fileContent ) . toContain ( 'transform(value: unknown, ...args: unknown[])' ) ;
66+ } ) ;
67+
68+ it ( 'should use a `.` type separator when specified' , async ( ) => {
69+ const tree = await schematicRunner . runSchematic (
70+ 'pipe' ,
71+ {
72+ ...defaultNonStandaloneOptions ,
73+ typeSeparator : '.' ,
74+ } ,
75+ appTree ,
76+ ) ;
77+ const files = tree . files ;
5978 expect ( files ) . toContain ( '/projects/bar/src/app/foo.pipe.spec.ts' ) ;
6079 expect ( files ) . toContain ( '/projects/bar/src/app/foo.pipe.ts' ) ;
6180 const moduleContent = getFileContent ( tree , '/projects/bar/src/app/app.module.ts' ) ;
@@ -65,13 +84,32 @@ describe('Pipe Schematic', () => {
6584 expect ( fileContent ) . toContain ( 'transform(value: unknown, ...args: unknown[])' ) ;
6685 } ) ;
6786
87+ it ( 'should use a `-` type separator when specified' , async ( ) => {
88+ const tree = await schematicRunner . runSchematic (
89+ 'pipe' ,
90+ {
91+ ...defaultNonStandaloneOptions ,
92+ typeSeparator : '-' ,
93+ } ,
94+ appTree ,
95+ ) ;
96+ const files = tree . files ;
97+ expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.spec.ts' ) ;
98+ expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.ts' ) ;
99+ const moduleContent = getFileContent ( tree , '/projects/bar/src/app/app.module.ts' ) ;
100+ expect ( moduleContent ) . toMatch ( / i m p o r t .* F o o .* f r o m ' .\/ f o o - p i p e ' / ) ;
101+ expect ( moduleContent ) . toMatch ( / d e c l a r a t i o n s : \s * \[ [ ^ \] ] + ?, \r ? \n \s + F o o P i p e \r ? \n / m) ;
102+ const fileContent = tree . readContent ( '/projects/bar/src/app/foo-pipe.ts' ) ;
103+ expect ( fileContent ) . toContain ( 'transform(value: unknown, ...args: unknown[])' ) ;
104+ } ) ;
105+
68106 it ( 'should import into a specified module' , async ( ) => {
69107 const options = { ...defaultNonStandaloneOptions , module : 'app.module.ts' } ;
70108
71109 const tree = await schematicRunner . runSchematic ( 'pipe' , options , appTree ) ;
72110 const appModule = getFileContent ( tree , '/projects/bar/src/app/app.module.ts' ) ;
73111
74- expect ( appModule ) . toMatch ( / i m p o r t { F o o P i p e } f r o m ' .\/ f o o . p i p e ' / ) ;
112+ expect ( appModule ) . toMatch ( / i m p o r t { F o o P i p e } f r o m ' .\/ f o o - p i p e ' / ) ;
75113 } ) ;
76114
77115 it ( 'should fail if specified module does not exist' , async ( ) => {
@@ -94,7 +132,7 @@ describe('Pipe Schematic', () => {
94132 appTree = await schematicRunner . runSchematic ( 'pipe' , options , appTree ) ;
95133
96134 const content = appTree . readContent ( '/projects/bar/src/app/admin/module/module.module.ts' ) ;
97- expect ( content ) . toMatch ( / i m p o r t { F o o P i p e } f r o m ' \. \. \/ \. \. \/ f o o . p i p e ' / ) ;
135+ expect ( content ) . toMatch ( / i m p o r t { F o o P i p e } f r o m ' \. \. \/ \. \. \/ f o o - p i p e ' / ) ;
98136 } ) ;
99137
100138 it ( 'should export the pipe' , async ( ) => {
@@ -110,10 +148,10 @@ describe('Pipe Schematic', () => {
110148
111149 const tree = await schematicRunner . runSchematic ( 'pipe' , options , appTree ) ;
112150 const files = tree . files ;
113- expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo. pipe.spec.ts' ) ;
114- expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo. pipe.ts' ) ;
151+ expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo- pipe.spec.ts' ) ;
152+ expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo- pipe.ts' ) ;
115153 const moduleContent = getFileContent ( tree , '/projects/bar/src/app/app.module.ts' ) ;
116- expect ( moduleContent ) . toMatch ( / i m p o r t .* F o o .* f r o m ' .\/ f o o \/ f o o . p i p e ' / ) ;
154+ expect ( moduleContent ) . toMatch ( / i m p o r t .* F o o .* f r o m ' .\/ f o o \/ f o o - p i p e ' / ) ;
117155 expect ( moduleContent ) . toMatch ( / d e c l a r a t i o n s : \s * \[ [ ^ \] ] + ?, \r ? \n \s + F o o P i p e \r ? \n / m) ;
118156 } ) ;
119157
@@ -124,7 +162,7 @@ describe('Pipe Schematic', () => {
124162 const options = { ...defaultNonStandaloneOptions , module : routingFileName } ;
125163 const tree = await schematicRunner . runSchematic ( 'pipe' , options , newTree ) ;
126164 const content = getFileContent ( tree , routingModulePath ) ;
127- expect ( content ) . toMatch ( / i m p o r t { F o o P i p e } f r o m ' .\/ f o o . p i p e / ) ;
165+ expect ( content ) . toMatch ( / i m p o r t { F o o P i p e } f r o m ' .\/ f o o - p i p e / ) ;
128166 } ) ;
129167
130168 it ( 'should respect the sourceRoot value' , async ( ) => {
@@ -143,7 +181,7 @@ describe('Pipe Schematic', () => {
143181 '/projects/bar/custom/app/app.module.ts' ,
144182 ) ;
145183 appTree = await schematicRunner . runSchematic ( 'pipe' , defaultNonStandaloneOptions , appTree ) ;
146- expect ( appTree . files ) . toContain ( '/projects/bar/custom/app/foo. pipe.ts' ) ;
184+ expect ( appTree . files ) . toContain ( '/projects/bar/custom/app/foo- pipe.ts' ) ;
147185 } ) ;
148186 } ) ;
149187
@@ -155,7 +193,7 @@ describe('Pipe Schematic', () => {
155193 it ( 'should create a standalone pipe' , async ( ) => {
156194 const tree = await schematicRunner . runSchematic ( 'pipe' , defaultOptions , appTree ) ;
157195 const moduleContent = tree . readContent ( '/projects/bar/src/app/app.module.ts' ) ;
158- const pipeContent = tree . readContent ( '/projects/bar/src/app/foo. pipe.ts' ) ;
196+ const pipeContent = tree . readContent ( '/projects/bar/src/app/foo- pipe.ts' ) ;
159197 expect ( pipeContent ) . not . toContain ( 'standalone' ) ;
160198 expect ( pipeContent ) . toContain ( 'class FooPipe' ) ;
161199 expect ( moduleContent ) . not . toContain ( 'FooPipe' ) ;
@@ -166,8 +204,8 @@ describe('Pipe Schematic', () => {
166204
167205 const tree = await schematicRunner . runSchematic ( 'pipe' , options , appTree ) ;
168206 const files = tree . files ;
169- expect ( files ) . not . toContain ( '/projects/bar/src/app/foo. pipe.spec.ts' ) ;
170- expect ( files ) . toContain ( '/projects/bar/src/app/foo. pipe.ts' ) ;
207+ expect ( files ) . not . toContain ( '/projects/bar/src/app/foo- pipe.spec.ts' ) ;
208+ expect ( files ) . toContain ( '/projects/bar/src/app/foo- pipe.ts' ) ;
171209 } ) ;
172210
173211 it ( 'should error when class name contains invalid characters' , async ( ) => {
0 commit comments