@@ -879,5 +879,62 @@ describe('Application Schematic', () => {
879879 expect(component).toContain(`templateUrl: './app.component.html'`);
880880 expect(component).toContain(`styleUrl: './app.component.css'`);
881881 });
882+
883+ it('should create a test file with import from the path without suffix', async () => {
884+ const options = { ...defaultOptions, fileNameStyleGuide: '2016' as const };
885+ const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
886+ const componentSpec = tree.readContent('/projects/foo/src/app/app.component.spec.ts');
887+ expect(componentSpec).toContain(`import { App } from './app.component'`);
888+ });
889+
890+ describe('standalone: false', () => {
891+ it('should create a component with the correct template and style urls', async () => {
892+ const options = {
893+ ...defaultOptions,
894+ standalone: false,
895+ fileNameStyleGuide: '2016' as const,
896+ };
897+ const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
898+ const component = tree.readContent('/projects/foo/src/app/app.component.ts');
899+ expect(component).toContain(`templateUrl: './app.component.html'`);
900+ expect(component).toContain(`styleUrl: './app.component.css'`);
901+ });
902+
903+ it('should create a test file with import from the path without suffix', async () => {
904+ const options = {
905+ ...defaultOptions,
906+ standalone: false,
907+ fileNameStyleGuide: '2016' as const,
908+ };
909+ const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
910+ const componentSpec = tree.readContent('/projects/foo/src/app/app.component.spec.ts');
911+ expect(componentSpec).toContain(`import { App } from './app.component'`);
912+ });
913+
914+ it('should create a module with the correct suffix', async () => {
915+ const options = {
916+ ...defaultOptions,
917+ standalone: false,
918+ fileNameStyleGuide: '2016' as const,
919+ };
920+ const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
921+ const module = tree.readContent('/projects/foo/src/app/app.module.ts');
922+ expect(module).toContain(`import { App } from './app.component'`);
923+ });
924+
925+ it('should create a routing module with the correct suffix', async () => {
926+ const options = {
927+ ...defaultOptions,
928+ standalone: false,
929+ routing: true,
930+ fileNameStyleGuide: '2016' as const,
931+ };
932+ const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
933+ const module = tree.readContent('/projects/foo/src/app/app.module.ts');
934+ const routingModule = tree.readContent('/projects/foo/src/app/app-routing.module.ts');
935+ expect(routingModule).toBeDefined();
936+ expect(module).toContain(`import { AppRoutingModule } from './app-routing.module'`);
937+ });
938+ });
882939 });
883940});
0 commit comments