@@ -145,6 +145,10 @@ test('errors when older version passed', async () => {
145145 expect ( logger . error ) . toBeCalledWith (
146146 `Trying to upgrade from newer version "${ currentVersion } " to older "${ olderVersion } "` ,
147147 ) ;
148+ await upgrade . func ( [ '0.57.10' ] , ctx , opts ) ;
149+ expect ( logger . error ) . not . toBeCalledWith (
150+ `Trying to upgrade from newer version "${ currentVersion } " to older "0.57.10"` ,
151+ ) ;
148152} ) ;
149153
150154test ( 'warns when dependency upgrade version is in semver range' , async ( ) => {
@@ -170,12 +174,10 @@ success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the
170174` ) ;
171175} ) ;
172176
173- test (
174- 'fetches regular patch, adds remote, applies patch, installs deps, removes remote,' ,
175- async ( ) => {
176- ( fetch : any ) . mockImplementation ( ( ) => Promise . resolve ( samplePatch ) ) ;
177- await upgrade . func ( [ newVersion ] , ctx , opts ) ;
178- expect ( flushOutput ( ) ) . toMatchInlineSnapshot ( `
177+ test ( 'fetches regular patch, adds remote, applies patch, installs deps, removes remote,' , async ( ) => {
178+ ( fetch : any ) . mockImplementation ( ( ) => Promise . resolve ( samplePatch ) ) ;
179+ await upgrade . func ( [ newVersion ] , ctx , opts ) ;
180+ expect ( flushOutput ( ) ) . toMatchInlineSnapshot ( `
179181"info Fetching diff between v0.57.8 and v0.58.4...
180182[fs] write tmp-upgrade-rn.patch
181183$ execa git rev-parse --show-prefix
@@ -194,22 +196,18 @@ info Running \\"git status\\" to check what changed...
194196$ execa git status
195197success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes"
196198` ) ;
197- expect (
198- snapshotDiff ( samplePatch , fs . writeFileSync . mock . calls [ 0 ] [ 1 ] , {
199- contextLines : 1 ,
200- } ) ,
201- ) . toMatchSnapshot ( 'RnDiffApp is replaced with app name (TestApp)' ) ;
202- } ,
203- 60000 ,
204- ) ;
205- test (
206- 'fetches regular patch, adds remote, applies patch, installs deps, removes remote when updated from nested directory' ,
207- async ( ) => {
208- ( fetch : any ) . mockImplementation ( ( ) => Promise . resolve ( samplePatch ) ) ;
209- ( execa : any ) . mockImplementation ( mockExecaNested ) ;
210- const config = { ...ctx , root : '/project/root/NestedApp' } ;
211- await upgrade . func ( [ newVersion ] , config , opts ) ;
212- expect ( flushOutput ( ) ) . toMatchInlineSnapshot ( `
199+ expect (
200+ snapshotDiff ( samplePatch , fs . writeFileSync . mock . calls [ 0 ] [ 1 ] , {
201+ contextLines : 1 ,
202+ } ) ,
203+ ) . toMatchSnapshot ( 'RnDiffApp is replaced with app name (TestApp)' ) ;
204+ } , 60000 ) ;
205+ test ( 'fetches regular patch, adds remote, applies patch, installs deps, removes remote when updated from nested directory' , async ( ) => {
206+ ( fetch : any ) . mockImplementation ( ( ) => Promise . resolve ( samplePatch ) ) ;
207+ ( execa : any ) . mockImplementation ( mockExecaNested ) ;
208+ const config = { ...ctx , root : '/project/root/NestedApp' } ;
209+ await upgrade . func ( [ newVersion ] , config , opts ) ;
210+ expect ( flushOutput ( ) ) . toMatchInlineSnapshot ( `
213211"info Fetching diff between v0.57.8 and v0.58.4...
214212[fs] write tmp-upgrade-rn.patch
215213$ execa git rev-parse --show-prefix
@@ -228,9 +226,7 @@ info Running \\"git status\\" to check what changed...
228226$ execa git status
229227success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes"
230228` ) ;
231- } ,
232- 60000 ,
233- ) ;
229+ } , 60000 ) ;
234230test ( 'cleans up if patching fails,' , async ( ) => {
235231 ( fetch : any ) . mockImplementation ( ( ) => Promise . resolve ( samplePatch ) ) ;
236232 ( execa : any ) . mockImplementation ( ( command , args ) => {
0 commit comments