@@ -57,6 +57,75 @@ describe('@schematics/update:migrate', () => {
57
57
} ) ,
58
58
) . toPromise ( ) . then ( done , done . fail ) ;
59
59
} ) ;
60
+
61
+ it ( 'supports partial version ranges with only major' , done => {
62
+ // Since we cannot run tasks in unit tests, we need to validate that the default
63
+ // update schematic updates the package.json appropriately, AND validate that the
64
+ // migrate schematic actually do work appropriately, in a separate test.
65
+ schematicRunner . runSchematicAsync ( 'migrate' , {
66
+ package : 'test' ,
67
+ collection : require . resolve ( './test/migration.json' ) ,
68
+ from : '1' ,
69
+ to : '2' ,
70
+ } , appTree ) . pipe (
71
+ map ( tree => {
72
+ const resultJson = JSON . parse ( tree . readContent ( '/migrations' ) ) ;
73
+
74
+ expect ( resultJson ) . toEqual ( [
75
+ 'migration-03' , // "1.0.5"
76
+ 'migration-05' , // "1.1.0-beta.0"
77
+ 'migration-04' , // "1.1.0-beta.1"
78
+ 'migration-02' , // "1.1.0"
79
+ 'migration-13' , // "1.1.0"
80
+ 'migration-19' , // "1.1"
81
+ 'migration-06' , // "1.4.0"
82
+ 'migration-17' , // "2.0.0-alpha"
83
+ 'migration-16' , // "2.0.0-alpha.5"
84
+ 'migration-08' , // "2.0.0-beta.0"
85
+ 'migration-07' , // "2.0.0-rc.0"
86
+ 'migration-12' , // "2.0.0-rc.4"
87
+ 'migration-14' , // "2.0.0"
88
+ 'migration-20' , // "2"
89
+ 'migration-15' , // "2.0.1"
90
+ 'migration-11' , // "2.1.0"
91
+ ] ) ;
92
+ } ) ,
93
+ ) . toPromise ( ) . then ( done , done . fail ) ;
94
+ } ) ;
95
+
96
+ it ( 'supports partial version ranges with major and minor' , done => {
97
+ // Since we cannot run tasks in unit tests, we need to validate that the default
98
+ // update schematic updates the package.json appropriately, AND validate that the
99
+ // migrate schematic actually do work appropriately, in a separate test.
100
+ schematicRunner . runSchematicAsync ( 'migrate' , {
101
+ package : 'test' ,
102
+ collection : require . resolve ( './test/migration.json' ) ,
103
+ from : '1.0' ,
104
+ to : '2.0' ,
105
+ } , appTree ) . pipe (
106
+ map ( tree => {
107
+ const resultJson = JSON . parse ( tree . readContent ( '/migrations' ) ) ;
108
+
109
+ expect ( resultJson ) . toEqual ( [
110
+ 'migration-03' , // "1.0.5"
111
+ 'migration-05' , // "1.1.0-beta.0"
112
+ 'migration-04' , // "1.1.0-beta.1"
113
+ 'migration-02' , // "1.1.0"
114
+ 'migration-13' , // "1.1.0"
115
+ 'migration-19' , // "1.1"
116
+ 'migration-06' , // "1.4.0"
117
+ 'migration-17' , // "2.0.0-alpha"
118
+ 'migration-16' , // "2.0.0-alpha.5"
119
+ 'migration-08' , // "2.0.0-beta.0"
120
+ 'migration-07' , // "2.0.0-rc.0"
121
+ 'migration-12' , // "2.0.0-rc.4"
122
+ 'migration-14' , // "2.0.0"
123
+ 'migration-20' , // "2"
124
+ 'migration-15' , // "2.0.1"
125
+ ] ) ;
126
+ } ) ,
127
+ ) . toPromise ( ) . then ( done , done . fail ) ;
128
+ } ) ;
60
129
} ) ;
61
130
62
131
0 commit comments