diff options
-rwxr-xr-x | bin/cmd.js | 1 | ||||
-rw-r--r-- | test/basic.js | 25 |
2 files changed, 22 insertions, 4 deletions
@@ -158,7 +158,6 @@ function remove (cb) { var torrent = client.add(torrentId) - torrent.on('infoHash', function () { function updateMetadata () { var numPeers = torrent.swarm.numPeers diff --git a/test/basic.js b/test/basic.js index 0013650..0801452 100644 --- a/test/basic.js +++ b/test/basic.js @@ -16,10 +16,29 @@ test('Module usage (sanity check)', function (t) { }) }) -test('Command line usage (sanity check)', function (t) { +test('Command line: --help', function (t) { + t.plan(2) + var bin = __dirname + '/../bin/cmd.js --help' - cp.exec(bin, function (err) { + cp.exec(bin, function (err, data) { t.error(err) // no error, exit code 0 - t.end() + t.ok(data.indexOf('usage') !== 0) + }) +}) + +test('Command line: -v --version', function (t) { + t.plan(4) + var expectedVersion = require(__dirname + '/../package.json').version + '\n' + + var bin = __dirname + '/../bin/cmd.js --version' + cp.exec(bin, function (err, data) { + t.error(err) // no error, exit code 0 + t.equal(data, expectedVersion) + }) + + bin = __dirname + '/../bin/cmd.js -v' + cp.exec(bin, function (err, data) { + t.error(err) // no error, exit code 0 + t.equal(data, expectedVersion) }) }) |