@@ -2,6 +2,7 @@ import * as path from 'path';
22
33import { EmptyTree } from '@angular-devkit/schematics' ;
44import { SchematicTestRunner , UnitTestTree } from '@angular-devkit/schematics/testing' ;
5+ import { ProjectType } from '../../schematics/utils/util' ;
56
67const version = '15.0.4' ;
78
@@ -24,18 +25,44 @@ describe(`Update to ${version}`, () => {
2425 } ,
2526 version : 1
2627 } ;
28+ const configJsonLib = {
29+ defaultProject : 'testProj' ,
30+ projects : {
31+ testProj : {
32+ root : '/' ,
33+ sourceRoot : '/testSrc' ,
34+ prefix : 'lib' ,
35+ projectType : ProjectType . Library ,
36+ architect : {
37+ build : {
38+ options : {
39+ }
40+ }
41+ }
42+ }
43+ } ,
44+ version : 1
45+ } ;
2746
2847 beforeEach ( ( ) => {
2948 appTree = new UnitTestTree ( new EmptyTree ( ) ) ;
30- appTree . create ( '/angular.json' , JSON . stringify ( configJson ) ) ;
3149 } ) ;
3250
3351 const migrationName = 'migration-27' ;
3452
3553 it ( `should add igniteui-theming to pacakage json and configure it` , async ( ) => {
54+ appTree . create ( '/angular.json' , JSON . stringify ( configJson ) ) ;
3655 const tree = await schematicRunner . runSchematicAsync ( migrationName , { } , appTree )
3756 . toPromise ( ) ;
3857
3958 expect ( JSON . parse ( JSON . stringify ( tree . readContent ( 'angular.json' ) ) ) ) . toContain ( "stylePreprocessorOptions" ) ;
4059 } ) ;
60+
61+ it ( `should not add igniteui-theming to library pacakage json and configure it` , async ( ) => {
62+ appTree . create ( '/angular.json' , JSON . stringify ( configJsonLib ) ) ;
63+ const tree = await schematicRunner . runSchematicAsync ( migrationName , { } , appTree )
64+ . toPromise ( ) ;
65+
66+ expect ( JSON . parse ( JSON . stringify ( tree . readContent ( 'angular.json' ) ) ) ) . not . toContain ( "stylePreprocessorOptions" ) ;
67+ } ) ;
4168} ) ;
0 commit comments