@@ -47,6 +47,7 @@ describe('Application Schematic', () => {
47
47
expect ( files . indexOf ( '/projects/foo/karma.conf.js' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
48
48
expect ( files . indexOf ( '/projects/foo/tsconfig.app.json' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
49
49
expect ( files . indexOf ( '/projects/foo/tsconfig.spec.json' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
50
+ expect ( files . indexOf ( '/projects/foo/tslint.json' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
50
51
expect ( files . indexOf ( '/projects/foo/src/environments/environment.ts' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
51
52
expect ( files . indexOf ( '/projects/foo/src/environments/environment.prod.ts' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
52
53
expect ( files . indexOf ( '/projects/foo/src/favicon.ico' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
@@ -109,6 +110,15 @@ describe('Application Schematic', () => {
109
110
expect ( specTsConfig . files ) . toEqual ( [ 'src/test.ts' , 'src/polyfills.ts' ] ) ;
110
111
} ) ;
111
112
113
+ it ( 'should set the right path and prefix in the tslint file' , ( ) => {
114
+ const tree = schematicRunner . runSchematic ( 'application' , defaultOptions , workspaceTree ) ;
115
+ const path = '/projects/foo/tslint.json' ;
116
+ const content = JSON . parse ( tree . readContent ( path ) ) ;
117
+ expect ( content . extends ) . toMatch ( '../../tslint.json' ) ;
118
+ expect ( content . rules [ 'directive-selector' ] [ 2 ] ) . toMatch ( 'app' ) ;
119
+ expect ( content . rules [ 'component-selector' ] [ 2 ] ) . toMatch ( 'app' ) ;
120
+ } ) ;
121
+
112
122
describe ( `update package.json` , ( ) => {
113
123
it ( `should add build-angular to devDependencies` , ( ) => {
114
124
const tree = schematicRunner . runSchematic ( 'application' , defaultOptions , workspaceTree ) ;
@@ -157,6 +167,7 @@ describe('Application Schematic', () => {
157
167
expect ( files . indexOf ( '/src/karma.conf.js' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
158
168
expect ( files . indexOf ( '/src/tsconfig.app.json' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
159
169
expect ( files . indexOf ( '/src/tsconfig.spec.json' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
170
+ expect ( files . indexOf ( '/src/tslint.json' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
160
171
expect ( files . indexOf ( '/src/environments/environment.ts' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
161
172
expect ( files . indexOf ( '/src/environments/environment.prod.ts' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
162
173
expect ( files . indexOf ( '/src/favicon.ico' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
@@ -196,5 +207,15 @@ describe('Application Schematic', () => {
196
207
expect ( specTsConfig . extends ) . toEqual ( '../tsconfig.json' ) ;
197
208
expect ( specTsConfig . files ) . toEqual ( [ 'test.ts' , 'polyfills.ts' ] ) ;
198
209
} ) ;
210
+
211
+ it ( 'should set the relative path and prefix in the tslint file' , ( ) => {
212
+ const options = { ...defaultOptions , projectRoot : '' } ;
213
+
214
+ const tree = schematicRunner . runSchematic ( 'application' , options , workspaceTree ) ;
215
+ const content = JSON . parse ( tree . readContent ( '/src/tslint.json' ) ) ;
216
+ expect ( content . extends ) . toMatch ( '../tslint.json' ) ;
217
+ expect ( content . rules [ 'directive-selector' ] [ 2 ] ) . toMatch ( 'app' ) ;
218
+ expect ( content . rules [ 'component-selector' ] [ 2 ] ) . toMatch ( 'app' ) ;
219
+ } ) ;
199
220
} ) ;
200
221
} ) ;
0 commit comments