8
8
9
9
import { SchematicTestRunner , UnitTestTree } from '@angular-devkit/schematics/testing' ;
10
10
import { Schema as ApplicationOptions } from '../application/schema' ;
11
- import { createAppModule , getFileContent } from '../utility/test' ;
11
+ import { createAppModule } from '../utility/test' ;
12
12
import { Schema as WorkspaceOptions } from '../workspace/schema' ;
13
13
import { Schema as PipeOptions } from './schema' ;
14
14
@@ -58,7 +58,7 @@ describe('Pipe Schematic', () => {
58
58
const files = tree . files ;
59
59
expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.spec.ts' ) ;
60
60
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' ) ;
62
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
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
64
const fileContent = tree . readContent ( '/projects/bar/src/app/foo-pipe.ts' ) ;
@@ -77,7 +77,7 @@ describe('Pipe Schematic', () => {
77
77
const files = tree . files ;
78
78
expect ( files ) . toContain ( '/projects/bar/src/app/foo.pipe.spec.ts' ) ;
79
79
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' ) ;
81
81
expect ( moduleContent ) . toMatch ( / i m p o r t .* F o o .* f r o m ' .\/ f o o .p i p e ' / ) ;
82
82
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) ;
83
83
const fileContent = tree . readContent ( '/projects/bar/src/app/foo.pipe.ts' ) ;
@@ -96,7 +96,7 @@ describe('Pipe Schematic', () => {
96
96
const files = tree . files ;
97
97
expect ( files ) . toContain ( '/projects/bar/src/app/foo-pipe.spec.ts' ) ;
98
98
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' ) ;
100
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
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
102
const fileContent = tree . readContent ( '/projects/bar/src/app/foo-pipe.ts' ) ;
@@ -107,7 +107,7 @@ describe('Pipe Schematic', () => {
107
107
const options = { ...defaultNonStandaloneOptions , module : 'app-module.ts' } ;
108
108
109
109
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' ) ;
111
111
112
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 ' / ) ;
113
113
} ) ;
@@ -139,7 +139,7 @@ describe('Pipe Schematic', () => {
139
139
const options = { ...defaultNonStandaloneOptions , export : true } ;
140
140
141
141
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' ) ;
143
143
expect ( appModuleContent ) . toMatch ( / e x p o r t s : \[ \n ( \s * ) { 2 } F o o P i p e \n \1\] / ) ;
144
144
} ) ;
145
145
@@ -150,7 +150,7 @@ describe('Pipe Schematic', () => {
150
150
const files = tree . files ;
151
151
expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo-pipe.spec.ts' ) ;
152
152
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' ) ;
154
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 ' / ) ;
155
155
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) ;
156
156
} ) ;
@@ -161,7 +161,7 @@ describe('Pipe Schematic', () => {
161
161
const newTree = createAppModule ( appTree , routingModulePath ) ;
162
162
const options = { ...defaultNonStandaloneOptions , module : routingFileName } ;
163
163
const tree = await schematicRunner . runSchematic ( 'pipe' , options , newTree ) ;
164
- const content = getFileContent ( tree , routingModulePath ) ;
164
+ const content = tree . readText ( routingModulePath ) ;
165
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 / ) ;
166
166
} ) ;
167
167
0 commit comments