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:
authorJimmy Wärting <jimmy@warting.se>2018-08-24 14:50:22 +0300
committerJimmy Wärting <jimmy@warting.se>2018-08-24 14:50:22 +0300
commitbaed9c5ba70db2d37ba9d326c885c2082633a9f0 (patch)
treec5d9148022e6301832af2bcc54c149bd5b061830 /test
parent3f89fe9c1ed4643d9a9f8099b43e39fb297e85ff (diff)
Added test for file.downloaded
Diffstat (limited to 'test')
-rw-r--r--test/node/basic.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/node/basic.js b/test/node/basic.js
index 7559309..f01aeef 100644
--- a/test/node/basic.js
+++ b/test/node/basic.js
@@ -112,7 +112,7 @@ test('client.seed: filesystem path to folder with one file, string', function (t
})
test('client.seed: filesystem path to folder with multiple files, string', function (t) {
- t.plan(6)
+ t.plan(7)
var client = new WebTorrent({ dht: false, tracker: false })
@@ -124,6 +124,17 @@ test('client.seed: filesystem path to folder with multiple files, string', funct
t.equal(torrent.infoHash, fixtures.numbers.parsedTorrent.infoHash)
t.equal(torrent.magnetURI, fixtures.numbers.magnetURI)
+ const downloaded = torrent.files.map(file => ({
+ length: file.length,
+ downloaded: file.downloaded
+ }))
+
+ t.deepEqual(downloaded, [
+ { length: 1, downloaded: 1 },
+ { length: 2, downloaded: 2 },
+ { length: 3, downloaded: 3 }
+ ], 'expected downloaded to be calculated correctly')
+
client.remove(torrent, function (err) { t.error(err, 'torrent destroyed') })
t.equal(client.torrents.length, 0)