11import { SchematicTestRunner , UnitTestTree } from '@angular-devkit/schematics/testing' ;
22import { Schema as WorkspaceOptions } from '@schematics/angular/workspace/schema' ;
3+ import { strings , basename , normalize } from '@angular-devkit/core' ;
34import * as path from 'path' ;
45
56const collectionPath = path . join ( __dirname , '../collection.json' ) ;
@@ -45,6 +46,7 @@ describe('view', () => {
4546
4647 it ( 'should create new view' , async ( ) => {
4748 const runner = new SchematicTestRunner ( 'schematics' , collectionPath ) ;
49+ const componentName = componentOptions . name ;
4850 let tree = await runner . runSchematic ( 'add-layout' , { layout : 'side-nav-outer-toolbar' } , appTree ) ;
4951 tree = await runner . runSchematic ( 'add-view' , componentOptions , appTree ) ;
5052
@@ -55,7 +57,11 @@ describe('view', () => {
5557 const contentTS = tree . readContent ( '/src/app/pages/test/test.component.ts' ) ;
5658
5759 expect ( contentHTML ) . toMatch ( / < h 2 > T e s t < \/ h 2 > / ) ;
60+ expect ( contentTS ) . toContain ( `selector: 'app-${ componentName } '` ) ;
61+ expect ( contentTS ) . toContain ( `templateUrl: './${ componentName } .component.html'` ) ;
62+ expect ( contentTS ) . toContain ( `styleUrl: './${ componentName } .component.css'` ) ;
5863 expect ( contentTS ) . toContain ( 'standalone: false' ) ;
64+ expect ( contentTS ) . toContain ( `export class ${ strings . classify ( basename ( normalize ( componentName ) ) ) } Component` ) ;
5965 } ) ;
6066
6167 it ( 'should add view to default routing module' , async ( ) => {
0 commit comments