|
5 | 5 | * Use of this source code is governed by an MIT-style license that can be
|
6 | 6 | * found in the LICENSE file at https://angular.io/license
|
7 | 7 | */
|
8 |
| -import { Path, strings } from '@angular-devkit/core'; |
| 8 | +import { Path } from '@angular-devkit/core'; |
9 | 9 | import { EmptyTree, Tree } from '@angular-devkit/schematics';
|
10 | 10 | import { ModuleOptions, findModule, findModuleFromOptions } from './find-module';
|
11 | 11 |
|
@@ -111,12 +111,20 @@ describe('find-module', () => {
|
111 | 111 | expect(modPath).toEqual('/projects/my-proj/src/app.module.ts' as Path);
|
112 | 112 | });
|
113 | 113 |
|
114 |
| - it('should find a module if nameFormatter is provided', () => { |
115 |
| - tree.create('/projects/my-proj/src/app_test.module.ts', ''); |
| 114 | + it('should find a module when name has underscore', () => { |
| 115 | + tree.create('/projects/my-proj/src/feature_module/app_test.module.ts', ''); |
116 | 116 | options.path = '/projects/my-proj/src';
|
117 |
| - options.nameFormatter = strings.underscore; |
| 117 | + options.name = 'feature_module/new_component'; |
118 | 118 | const modPath = findModuleFromOptions(tree, options);
|
119 |
| - expect(modPath).toEqual('/projects/my-proj/src/app_test.module.ts' as Path); |
| 119 | + expect(modPath).toEqual('/projects/my-proj/src/feature_module/app_test.module.ts' as Path); |
| 120 | + }); |
| 121 | + |
| 122 | + it('should find a module when name has uppercase', () => { |
| 123 | + tree.create('/projects/my-proj/src/featureModule/appTest.module.ts', ''); |
| 124 | + options.path = '/projects/my-proj/src'; |
| 125 | + options.name = 'featureModule/newComponent'; |
| 126 | + const modPath = findModuleFromOptions(tree, options); |
| 127 | + expect(modPath).toEqual('/projects/my-proj/src/featureModule/appTest.module.ts' as Path); |
120 | 128 | });
|
121 | 129 |
|
122 | 130 | it('should find a module if flat is true', () => {
|
|
0 commit comments