@@ -422,7 +422,7 @@ describe('updates', () => {
422
422
} ) ;
423
423
424
424
describe ( 'checkforUpdates' , ( ) => {
425
- it ( 'useAppcTooling false' , async ( ) => {
425
+ it ( 'useAppcTooling false no updates ' , async ( ) => {
426
426
const stub = global . sandbox . stub ( util , 'exec' ) ;
427
427
mockNodeRequest ( ) ;
428
428
mockSDKRequest ( ) ;
@@ -435,5 +435,63 @@ describe('updates', () => {
435
435
const updates = await checkAllUpdates ( { } , false ) ;
436
436
expect ( updates . length ) . to . equal ( 0 ) ;
437
437
} ) ;
438
+
439
+ it ( 'useAppcTooling false with updates' , async ( ) => {
440
+ const stub = global . sandbox . stub ( util , 'exec' ) ;
441
+ mockNodeRequest ( ) ;
442
+ mockSDKRequest ( ) ;
443
+ mockNpmRequest ( ) ;
444
+ mockSdk ( '8.0.0' ) ;
445
+ mockNode ( stub , '12.18.1' ) ;
446
+ mockNpmCli ( stub , 'alloy' , '1.15.3' ) ;
447
+ mockNpmCli ( stub , 'titanium' , '5.3.0' ) ;
448
+
449
+ const updates = await checkAllUpdates ( { } , false ) ;
450
+ expect ( updates . length ) . to . equal ( 2 ) ;
451
+
452
+ expect ( updates [ 0 ] . productName ) . to . equal ( 'Node.js' ) ;
453
+ expect ( updates [ 0 ] . currentVersion ) . to . equal ( '12.18.1' ) ;
454
+ expect ( updates [ 0 ] . latestVersion ) . to . equal ( '12.18.2' ) ;
455
+
456
+ expect ( updates [ 1 ] . productName ) . to . equal ( 'Alloy' ) ;
457
+ expect ( updates [ 1 ] . currentVersion ) . to . equal ( '1.15.3' ) ;
458
+ expect ( updates [ 1 ] . latestVersion ) . to . equal ( '1.15.4' ) ;
459
+ } ) ;
460
+
461
+ it ( 'useAppcTooling true no updates' , async ( ) => {
462
+ const stub = global . sandbox . stub ( util , 'exec' ) ;
463
+ mockNodeRequest ( ) ;
464
+ mockSDKRequest ( ) ;
465
+ mockNpmRequest ( ) ;
466
+ mockSdk ( '8.0.0' ) ;
467
+ mockNode ( stub , '12.18.2' ) ;
468
+ mockAppcCoreRequest ( '6.6.6' ) ;
469
+ mockAppcCli ( stub , '6.6.6' , '4.2.13' , true ) ;
470
+
471
+ const updates = await checkAllUpdates ( { } , true ) ;
472
+ expect ( updates . length ) . to . equal ( 0 ) ;
473
+ } ) ;
474
+
475
+ it ( 'useAppcTooling true with updates' , async ( ) => {
476
+ const stub = global . sandbox . stub ( util , 'exec' ) ;
477
+ mockNodeRequest ( ) ;
478
+ mockSDKRequest ( ) ;
479
+ mockNpmRequest ( ) ;
480
+ mockSdk ( '8.0.0' ) ;
481
+ mockNode ( stub , '12.18.1' ) ;
482
+ mockAppcCoreRequest ( '6.6.6' ) ;
483
+ mockAppcCli ( stub , '6.6.6' , '4.2.12' , true ) ;
484
+
485
+ const updates = await checkAllUpdates ( { } , true ) ;
486
+ expect ( updates . length ) . to . equal ( 2 ) ;
487
+
488
+ expect ( updates [ 0 ] . productName ) . to . equal ( 'Node.js' ) ;
489
+ expect ( updates [ 0 ] . currentVersion ) . to . equal ( '12.18.1' ) ;
490
+ expect ( updates [ 0 ] . latestVersion ) . to . equal ( '12.18.2' ) ;
491
+
492
+ expect ( updates [ 1 ] . productName ) . to . equal ( 'Appcelerator CLI (npm)' ) ;
493
+ expect ( updates [ 1 ] . currentVersion ) . to . equal ( '4.2.12' ) ;
494
+ expect ( updates [ 1 ] . latestVersion ) . to . equal ( '4.2.13' ) ;
495
+ } ) ;
438
496
} ) ;
439
497
} ) ;
0 commit comments