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
path: root/test
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-01-11 06:59:53 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-01-11 06:59:53 +0300
commitac3584b31b68a21b27a9ba40f96249debbf6fcad (patch)
treecbc492958e8b5518adb6d794143cc0cc5fe9469c /test
parent198ac76f6c476cee4b5d1774f9b667777a7d9b54 (diff)
command line: add `create` command
Fixes #232
Diffstat (limited to 'test')
-rw-r--r--test/cmd.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/cmd.js b/test/cmd.js
index 2cd0024..812bc96 100644
--- a/test/cmd.js
+++ b/test/cmd.js
@@ -78,5 +78,26 @@ test('Command line: webtorrent info magnet_uri', function (t) {
})
})
+test('Command line: webtorrent create /path/to/file', function (t) {
+ t.plan(1)
+
+ var leavesPath = __dirname + '/content/Leaves of Grass by Walt Whitman.epub'
+
+ var child = cp.spawn(CMD, [ 'create', leavesPath ])
+ child.on('error', function (err) {
+ throw err
+ })
+
+ var chunks = []
+ child.stdout.on('data', function (chunk) {
+ chunks.push(chunk)
+ })
+ child.stdout.on('end', function () {
+ var buf = Buffer.concat(chunks)
+ var parsedTorrent = parseTorrent(new Buffer(buf, 'binary'))
+ t.deepEqual(parsedTorrent.infoHash, 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36')
+ })
+})
+
// TODO: test 'webtorrent download /path/to/torrent'
// TODO: test 'webtorrent download magnet_uri'