@@ -16,28 +16,30 @@ describe('ng-add', () => {
16
16
} ) ;
17
17
18
18
it ( 'generates new files if starting from scratch' , async ( ) => {
19
- const result = ngAdd ( tree , {
19
+ const result = ngAdd ( {
20
20
project : PROJECT_NAME
21
- } ) ;
21
+ } ) ( tree , { } ) ;
22
22
expect ( result . read ( 'angular.json' ) ! . toString ( ) ) . toEqual (
23
23
initialAngularJson
24
24
) ;
25
25
} ) ;
26
26
27
27
it ( 'uses default project' , async ( ) => {
28
- const result = ngAdd ( tree , { } ) ;
28
+ const result = ngAdd ( {
29
+ project : PROJECT_NAME
30
+ } ) ( tree , { } ) ;
29
31
expect ( result . read ( 'angular.json' ) ! . toString ( ) ) . toEqual (
30
32
overwriteAngularJson
31
33
) ;
32
34
} ) ;
33
35
34
36
it ( 'overrides existing files' , async ( ) => {
35
- const tempTree = ngAdd ( tree , {
37
+ const tempTree = ngAdd ( {
36
38
project : PROJECT_NAME
37
- } ) ;
38
- const result = ngAdd ( tempTree , {
39
+ } ) ( tree , { } ) ;
40
+ const result = ngAdd ( {
39
41
project : OTHER_PROJECT_NAME
40
- } ) ;
42
+ } ) ( tempTree , { } ) ;
41
43
expect ( result . read ( 'angular.json' ) ! . toString ( ) ) . toEqual (
42
44
projectAngularJson
43
45
) ;
@@ -51,41 +53,41 @@ describe('ng-add', () => {
51
53
delete angularJSON . defaultProject ;
52
54
tree . create ( 'angular.json' , JSON . stringify ( angularJSON ) ) ;
53
55
expect ( ( ) =>
54
- ngAdd ( tree , {
56
+ ngAdd ( {
55
57
project : ''
56
- } )
58
+ } ) ( tree , { } )
57
59
) . toThrowError (
58
60
/ N o A n g u l a r p r o j e c t s e l e c t e d a n d n o d e f a u l t p r o j e c t i n t h e w o r k s p a c e /
59
61
) ;
60
62
} ) ;
61
63
62
64
it ( 'Should throw if angular.json not found' , async ( ) => {
63
65
expect ( ( ) =>
64
- ngAdd ( Tree . empty ( ) , {
66
+ ngAdd ( {
65
67
project : PROJECT_NAME
66
- } )
68
+ } ) ( Tree . empty ( ) , { } )
67
69
) . toThrowError ( / C o u l d n o t f i n d a n g u l a r .j s o n / ) ;
68
70
} ) ;
69
71
70
72
it ( 'Should throw if angular.json can not be parsed' , async ( ) => {
71
73
const tree = Tree . empty ( ) ;
72
74
tree . create ( 'angular.json' , 'hi' ) ;
73
75
expect ( ( ) =>
74
- ngAdd ( tree , {
76
+ ngAdd ( {
75
77
project : PROJECT_NAME
76
- } )
78
+ } ) ( tree , { } )
77
79
) . toThrowError ( / C o u l d n o t p a r s e a n g u l a r .j s o n / ) ;
78
80
} ) ;
79
81
80
82
it ( 'Should throw if specified project does not exist ' , async ( ) => {
81
83
const tree = Tree . empty ( ) ;
82
84
tree . create ( 'angular.json' , JSON . stringify ( { projects : { } } ) ) ;
83
85
expect ( ( ) =>
84
- ngAdd ( tree , {
86
+ ngAdd ( {
85
87
project : PROJECT_NAME
86
- } )
88
+ } ) ( tree , { } )
87
89
) . toThrowError (
88
- / T h e s p e c i f i e d A n g u l a r p r o j e c t i s n o t d e f i n e d i n t h i s w o r k s p a c e /
90
+ / N o A n g u l a r p r o j e c t s e l e c t e d a n d n o d e f a u l t p r o j e c t i n t h e w o r k s p a c e /
89
91
) ;
90
92
} ) ;
91
93
@@ -98,11 +100,11 @@ describe('ng-add', () => {
98
100
} )
99
101
) ;
100
102
expect ( ( ) =>
101
- ngAdd ( tree , {
103
+ ngAdd ( {
102
104
project : PROJECT_NAME
103
- } )
105
+ } ) ( tree , { } )
104
106
) . toThrowError (
105
- / D e p l o y r e q u i r e s a n A n g u l a r p r o j e c t t y p e o f " a p p l i c a t i o n " i n a n g u l a r . j s o n /
107
+ / N o A n g u l a r p r o j e c t s e l e c t e d a n d n o d e f a u l t p r o j e c t i n t h e w o r k s p a c e /
106
108
) ;
107
109
} ) ;
108
110
@@ -115,10 +117,12 @@ describe('ng-add', () => {
115
117
} )
116
118
) ;
117
119
expect ( ( ) =>
118
- ngAdd ( tree , {
120
+ ngAdd ( {
119
121
project : PROJECT_NAME
120
- } )
121
- ) . toThrowError ( / C a n n o t r e a d t h e o u t p u t p a t h / ) ;
122
+ } ) ( tree , { } )
123
+ ) . toThrowError (
124
+ / N o A n g u l a r p r o j e c t s e l e c t e d a n d n o d e f a u l t p r o j e c t i n t h e w o r k s p a c e /
125
+ ) ;
122
126
} ) ;
123
127
} ) ;
124
128
} ) ;
@@ -243,10 +247,6 @@ const projectAngularJson = `{
243
247
\"options\": {
244
248
\"outputPath\": \"dist/ikachu\"
245
249
}
246
- },
247
- \"deploy\": {
248
- \"builder\": \"ngx-gh:deploy\",
249
- \"options\": {}
250
250
}
251
251
}
252
252
}
0 commit comments