File tree Expand file tree Collapse file tree 2 files changed +9
-25
lines changed Expand file tree Collapse file tree 2 files changed +9
-25
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,8 @@ const BaseCommand = require('../base-command.js')
22
33class  Birthday  extends  BaseCommand  { 
44  async  exec  ( )  { 
5-     this . npm . config . set ( 'package' ,  [ '@npmcli/npm-birthday' ] ) 
65    this . npm . config . set ( 'yes' ,  true ) 
7-     const  exec  =  await  this . npm . cmd ( 'exec' ) 
8-     return  exec . exec ( [ 'npm-birthday' ] ) 
6+     return  this . npm . exec ( 'exec' ,  [ '@npmcli/npm-birthday' ] ) 
97  } 
108} 
119
Original file line number Diff line number Diff line change 11const  t  =  require ( 'tap' ) 
2- const  {  fake : mockNpm  }  =  require ( '../../fixtures/mock-npm' ) 
2+ const  {  real : mockNpm  }  =  require ( '../../fixtures/mock-npm' ) 
33
44t . test ( 'birthday' ,  async  t  =>  { 
5-   t . plan ( 4 ) 
6-   const  config  =  { 
7-     yes : false , 
8-     package : [ ] , 
9-   } 
10-   const  npm  =  mockNpm ( { 
11-     config, 
12-     cmd : async  ( cmd )  =>  { 
13-       t . ok ( cmd ,  'exec' ,  'calls out to exec command' ) 
14-       return  { 
15-         exec : async  ( args )  =>  { 
16-           t . equal ( npm . config . get ( 'yes' ) ,  true ,  'should say yes' ) 
17-           t . strictSame ( npm . config . get ( 'package' ) ,  [ '@npmcli/npm-birthday' ] , 
18-             'uses correct package' ) 
19-           t . strictSame ( args ,  [ 'npm-birthday' ] ,  'called with correct args' ) 
20-         } , 
21-       } 
5+   t . plan ( 2 ) 
6+   const  {  Npm }  =  mockNpm ( t ,  { 
7+     libnpmexec : ( args )  =>  { 
8+       t . ok ( args . yes ) 
9+       t . match ( args . args ,  [ '@npmcli/npm-birthday' ] ) 
2210    } , 
2311  } ) 
24-   const  Birthday  =  require ( '../../../lib/commands/birthday.js' ) 
25-   const  birthday  =  new  Birthday ( npm ) 
26- 
27-   await  birthday . exec ( [ ] ) 
12+   const  npm  =  new  Npm ( ) 
13+   await  npm . exec ( 'birthday' ,  [ ] ) 
2814} ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments