Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/cmd.js1
-rw-r--r--test/basic.js25
2 files changed, 22 insertions, 4 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index 5fa7ed7..c854cbd 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -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)
})
})