88
99import { SchematicTestRunner , UnitTestTree } from '@angular-devkit/schematics/testing' ;
1010import { Schema as ApplicationOptions } from '../application/schema' ;
11- import { createAppModule , getFileContent } from '../utility/test' ;
11+ import { createAppModule } from '../utility/test' ;
1212import { Schema as WorkspaceOptions } from '../workspace/schema' ;
1313import { Schema as PipeOptions } from './schema' ;
1414
@@ -58,7 +58,7 @@ describe('Pipe Schematic', () => {
5858 const files = tree . files ;
5959 expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.spec.ts' ) ;
6060 expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.ts' ) ;
61- const moduleContent = getFileContent ( tree , '/projects/bar/src/app/app-module.ts' ) ;
61+ const moduleContent = tree . readText ( '/projects/bar/src/app/app-module.ts' ) ;
6262 expect ( moduleContent ) . toMatch ( / i m p o r t .* F o o .* f r o m ' .\/ f o o - p i p e ' / ) ;
6363 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) ;
6464 const fileContent = tree . readContent ( '/projects/bar/src/app/foo-pipe.ts' ) ;
@@ -77,7 +77,7 @@ describe('Pipe Schematic', () => {
7777 const files = tree . files ;
7878 expect ( files ) . toContain ( '/projects/bar/src/app/foo.pipe.spec.ts' ) ;
7979 expect ( files ) . toContain ( '/projects/bar/src/app/foo.pipe.ts' ) ;
80- const moduleContent = getFileContent ( tree , '/projects/bar/src/app/app-module.ts' ) ;
80+ const moduleContent = tree . readText ( '/projects/bar/src/app/app-module.ts' ) ;
8181 expect ( moduleContent ) . toMatch ( / i m p o r t .* F o o .* f r o m ' .\/ f o o .p i p e ' / ) ;
8282 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) ;
8383 const fileContent = tree . readContent ( '/projects/bar/src/app/foo.pipe.ts' ) ;
@@ -96,7 +96,7 @@ describe('Pipe Schematic', () => {
9696 const files = tree . files ;
9797 expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.spec.ts' ) ;
9898 expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.ts' ) ;
99- const moduleContent = getFileContent ( tree , '/projects/bar/src/app/app-module.ts' ) ;
99+ const moduleContent = tree . readText ( '/projects/bar/src/app/app-module.ts' ) ;
100100 expect ( moduleContent ) . toMatch ( / i m p o r t .* F o o .* f r o m ' .\/ f o o - p i p e ' / ) ;
101101 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) ;
102102 const fileContent = tree . readContent ( '/projects/bar/src/app/foo-pipe.ts' ) ;
@@ -107,7 +107,7 @@ describe('Pipe Schematic', () => {
107107 const options = { ...defaultNonStandaloneOptions , module : 'app-module.ts' } ;
108108
109109 const tree = await schematicRunner . runSchematic ( 'pipe' , options , appTree ) ;
110- const appModule = getFileContent ( tree , '/projects/bar/src/app/app-module.ts' ) ;
110+ const appModule = tree . readText ( '/projects/bar/src/app/app-module.ts' ) ;
111111
112112 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 ' / ) ;
113113 } ) ;
@@ -139,7 +139,7 @@ describe('Pipe Schematic', () => {
139139 const options = { ...defaultNonStandaloneOptions , export : true } ;
140140
141141 const tree = await schematicRunner . runSchematic ( 'pipe' , options , appTree ) ;
142- const appModuleContent = getFileContent ( tree , '/projects/bar/src/app/app-module.ts' ) ;
142+ const appModuleContent = tree . readText ( '/projects/bar/src/app/app-module.ts' ) ;
143143 expect ( appModuleContent ) . toMatch ( / e x p o r t s : \[ \n ( \s * ) { 2 } F o o P i p e \n \1\] / ) ;
144144 } ) ;
145145
@@ -150,7 +150,7 @@ describe('Pipe Schematic', () => {
150150 const files = tree . files ;
151151 expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo-pipe.spec.ts' ) ;
152152 expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo-pipe.ts' ) ;
153- const moduleContent = getFileContent ( tree , '/projects/bar/src/app/app-module.ts' ) ;
153+ const moduleContent = tree . readText ( '/projects/bar/src/app/app-module.ts' ) ;
154154 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 ' / ) ;
155155 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) ;
156156 } ) ;
@@ -161,7 +161,7 @@ describe('Pipe Schematic', () => {
161161 const newTree = createAppModule ( appTree , routingModulePath ) ;
162162 const options = { ...defaultNonStandaloneOptions , module : routingFileName } ;
163163 const tree = await schematicRunner . runSchematic ( 'pipe' , options , newTree ) ;
164- const content = getFileContent ( tree , routingModulePath ) ;
164+ const content = tree . readText ( routingModulePath ) ;
165165 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 / ) ;
166166 } ) ;
167167
0 commit comments