@@ -41,37 +41,41 @@ describe('Service Schematic', () => {
41
41
appTree = schematicRunner . runSchematic ( 'application' , appOptions , appTree ) ;
42
42
} ) ;
43
43
44
- it ( 'should create a service' , ( ) => {
44
+ it ( 'should create a service' , async ( ) => {
45
45
const options = { ...defaultOptions } ;
46
46
47
- const tree = schematicRunner . runSchematic ( 'service' , options , appTree ) ;
47
+ const tree = await schematicRunner . runSchematicAsync ( 'service' , options , appTree )
48
+ . toPromise ( ) ;
48
49
const files = tree . files ;
49
50
expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo.service.spec.ts' ) ;
50
51
expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo.service.ts' ) ;
51
52
} ) ;
52
53
53
- it ( 'service should be tree-shakeable' , ( ) => {
54
+ it ( 'service should be tree-shakeable' , async ( ) => {
54
55
const options = { ...defaultOptions } ;
55
56
56
- const tree = schematicRunner . runSchematic ( 'service' , options , appTree ) ;
57
+ const tree = await schematicRunner . runSchematicAsync ( 'service' , options , appTree )
58
+ . toPromise ( ) ;
57
59
const content = tree . readContent ( '/projects/bar/src/app/foo/foo.service.ts' ) ;
58
60
expect ( content ) . toMatch ( / p r o v i d e d I n : ' r o o t ' / ) ;
59
61
} ) ;
60
62
61
- it ( 'should respect the skipTests flag' , ( ) => {
63
+ it ( 'should respect the skipTests flag' , async ( ) => {
62
64
const options = { ...defaultOptions , skipTests : true } ;
63
65
64
- const tree = schematicRunner . runSchematic ( 'service' , options , appTree ) ;
66
+ const tree = await schematicRunner . runSchematicAsync ( 'service' , options , appTree )
67
+ . toPromise ( ) ;
65
68
const files = tree . files ;
66
69
expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo.service.ts' ) ;
67
70
expect ( files ) . not . toContain ( '/projects/bar/src/app/foo/foo.service.spec.ts' ) ;
68
71
} ) ;
69
72
70
- it ( 'should respect the sourceRoot value' , ( ) => {
73
+ it ( 'should respect the sourceRoot value' , async ( ) => {
71
74
const config = JSON . parse ( appTree . readContent ( '/angular.json' ) ) ;
72
75
config . projects . bar . sourceRoot = 'projects/bar/custom' ;
73
76
appTree . overwrite ( '/angular.json' , JSON . stringify ( config , null , 2 ) ) ;
74
- appTree = schematicRunner . runSchematic ( 'service' , defaultOptions , appTree ) ;
77
+ appTree = await schematicRunner . runSchematicAsync ( 'service' , defaultOptions , appTree )
78
+ . toPromise ( ) ;
75
79
expect ( appTree . files ) . toContain ( '/projects/bar/custom/app/foo/foo.service.ts' ) ;
76
80
} ) ;
77
81
} ) ;
0 commit comments