@@ -129,6 +129,51 @@ describe('@schematics/update', () => {
129
129
) . subscribe ( undefined , done . fail , done ) ;
130
130
} , 45000 ) ;
131
131
132
+ it ( 'updates Angular as compatible with Angular N-1 (2)' , done => {
133
+ // Add the basic migration package.
134
+ const content = virtualFs . fileBufferToString ( host . sync . read ( normalize ( '/package.json' ) ) ) ;
135
+ const packageJson = JSON . parse ( content ) ;
136
+ const dependencies = packageJson [ 'dependencies' ] ;
137
+ dependencies [ '@angular-devkit-tests/update-peer-dependencies-angular-5-2' ] = '1.0.0' ;
138
+ dependencies [ '@angular/core' ] = '5.1.0' ;
139
+ dependencies [ '@angular/animations' ] = '5.1.0' ;
140
+ dependencies [ '@angular/common' ] = '5.1.0' ;
141
+ dependencies [ '@angular/compiler' ] = '5.1.0' ;
142
+ dependencies [ '@angular/platform-browser' ] = '5.1.0' ;
143
+ dependencies [ 'rxjs' ] = '5.5.0' ;
144
+ dependencies [ 'zone.js' ] = '0.8.26' ;
145
+ host . sync . write (
146
+ normalize ( '/package.json' ) ,
147
+ virtualFs . stringToFileBuffer ( JSON . stringify ( packageJson ) ) ,
148
+ ) ;
149
+
150
+ schematicRunner . runSchematicAsync ( 'update' , {
151
+ packages : [ '@angular/core' ] ,
152
+ next : true ,
153
+ } , appTree ) . pipe (
154
+ map ( tree => {
155
+ const packageJson = JSON . parse ( tree . readContent ( '/package.json' ) ) ;
156
+ expect ( packageJson [ 'dependencies' ] [ '@angular/core' ] [ 0 ] ) . toBe ( '6' ) ;
157
+
158
+ // Check install task.
159
+ expect ( schematicRunner . tasks ) . toEqual ( [
160
+ {
161
+ name : 'node-package' ,
162
+ options : jasmine . objectContaining ( {
163
+ command : 'install' ,
164
+ } ) ,
165
+ } ,
166
+ {
167
+ name : 'run-schematic' ,
168
+ options : jasmine . objectContaining ( {
169
+ name : 'migrate' ,
170
+ } ) ,
171
+ } ,
172
+ ] ) ;
173
+ } ) ,
174
+ ) . subscribe ( undefined , done . fail , done ) ;
175
+ } , 45000 ) ;
176
+
132
177
it ( 'can migrate only' , done => {
133
178
// Add the basic migration package.
134
179
const content = virtualFs . fileBufferToString ( host . sync . read ( normalize ( '/package.json' ) ) ) ;
0 commit comments