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:
authorFeross Aboukhadijeh <feross@feross.org>2014-12-17 05:08:03 +0300
committerFeross Aboukhadijeh <feross@feross.org>2014-12-17 05:08:03 +0300
commitc0d1c9ccb7a281fcfc507f858be418dacb7a5f32 (patch)
tree02890a836b597ff0532ffb24d0c9284178b0aad0 /test/basic-node.js
parentb8cfe8ea3cde0f0e18d9facc1c3924e783d7f2d0 (diff)
add client.seed test for path to folder (string)
Diffstat (limited to 'test/basic-node.js')
-rw-r--r--test/basic-node.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/basic-node.js b/test/basic-node.js
index caf69b6..9304afe 100644
--- a/test/basic-node.js
+++ b/test/basic-node.js
@@ -9,6 +9,7 @@ var leavesPath = __dirname + '/torrents/leaves.torrent'
var leaves = fs.readFileSync(leavesPath)
var leavesTorrent = parseTorrent(leaves)
var leavesBookPath = __dirname + '/content/Leaves of Grass by Walt Whitman.epub'
+var numbersPath = __dirname + '/content/numbers'
test('client.add (http url to a torrent file (string))', function (t) {
t.plan(1)
@@ -50,3 +51,21 @@ test('client.seed (filesystem path to file (string))', function (t) {
client.destroy()
})
})
+
+test('client.seed (filesystem path to folder (string))', function (t) {
+ t.plan(1)
+
+ var opts = {
+ pieceLength: 32768, // force piece length to 32KB so info-hash will
+ // match what transmission generated, since we use
+ // a different algo for picking piece length
+
+ private: false // also force `private: false` to match transmission
+ }
+
+ var client = new WebTorrent({ dht: false, trackers: false })
+ client.seed(numbersPath, opts, function (torrent) {
+ t.equal(torrent.infoHash, '80562f38656b385ea78959010e51a2cc9db41ea0')
+ client.destroy()
+ })
+})