title: How do I test a command line application that does not take parameters?
body: <p>I have a command line application that takes 4 arguments and I am now writing unit tests for them. I just have some questions about how to exactly write these tests since my function does not take in any parameters?</p>
  
  <p>So in console, to run the app it would be 
  test.js arg1 arg2 arg3 arg4
  output.</p>
  
  <p>I can wrap the entire function in a bigger function and assign parameters and then test it that way, but is there a better method? Like fake input from user?</p>
  
  <pre><code>function test(){
    arg1 = process.argv[2];
    arg2 = process.argv[3];
    arg3 = process.argv[4];
    arg4 = process.argv[5];
  
    console.log(arg1 + arg2 + arg3 + arg4);
  }
  </code></pre>
  
  <p>So I want to test if any of the input is empty? the error should produce "Need all 4 entries". That's the jist of it, how do I write the unit test for that?</p>