var should = require('should');

// Usage: index [options] <word>
//
//   Options:
//
//     -h, --help     output usage information
//     -V, --version  output the version number
//     -i, --image    Search Image on Google
//     -n, --news     Search News on Google
//     -v, --video    Search Video on Google
//     -p, --patent   Search Patent on Google
//     -b, --book     Search Book on Google
//
//   Examples:
//
//     $ googleit weather-tomorrow
//     $ googleit -i cat
//     $ googleit -b harry-potter

var exec = require('child_process').exec;

var cmd = 'node index.js --help';
testHelpOutputWithCommand(cmd);
cmd = 'node index.js -h';
testHelpOutputWithCommand(cmd);

function testHelpOutputWithCommand(cmd) {
  exec(cmd, function(error, stdout, stderr) {
    result = stdout;

    // Test text setion
    result.includes('Usage:').should.equal(true);
    result.includes('Options:').should.equal(true);
    result.includes('Examples:').should.equal(true);

    // Test Usage content
    result.includes('index [options] <word>').should.equal(true);

    // Test Option content
    result.includes('-h, --help     output usage information').should.equal(true);
    result.includes('-V, --version  output the version number').should.equal(true);
    result.includes('-i, --image    Search Image on Google').should.equal(true);
    result.includes('-n, --news     Search News on Google').should.equal(true);
    result.includes('-v, --video    Search Video on Google').should.equal(true);
    result.includes('-p, --patent   Search Patent on Google').should.equal(true);
    result.includes('-b, --book     Search Book on Google').should.equal(true);

    // Test Examples content
    result.includes('$ googleit weather-tomorrow').should.equal(true);
    result.includes('$ googleit -i cat').should.equal(true);
    result.includes('$ googleit -b harry-potter').should.equal(true);
  })
}

@@ -1115,37 +1115,76 @@
 udes('-h, --help
-     
+').should.equal(true);%0A    result.includes('
 output usage inf
@@ -1240,34 +1240,76 @@
 s('-V, --version
-  
+').should.equal(true);%0A    result.includes('
 output the versi
@@ -1364,36 +1364,76 @@
 des('-i, --image
-    
+').should.equal(true);%0A    result.includes('
 Search Image on 
@@ -1484,37 +1484,76 @@
 udes('-n, --news
-     
+').should.equal(true);%0A    result.includes('
 Search News on G
@@ -1604,36 +1604,76 @@
 des('-v, --video
-    
+').should.equal(true);%0A    result.includes('
 Search Video on 
@@ -1726,35 +1726,76 @@
 es('-p, --patent
-   
+').should.equal(true);%0A    result.includes('
 Search Patent on
@@ -1847,37 +1847,76 @@
 udes('-b, --book
-     
+').should.equal(true);%0A    result.includes('
 Search Book on G

Fix test