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:
authorAlex <alxmorais8@msn.com>2019-08-12 16:41:54 +0300
committerAlex <alxmorais8@msn.com>2019-08-12 16:41:54 +0300
commit35fc44f9b98d6970244a517a5a9ca6175a3b40f5 (patch)
tree028150c3d01ccc35757dcb815eefeb5dff09cb15 /test
parent26dcc3fb29e3d9fa4b94fe195aae7ba028684178 (diff)
Rename util function for tests
Diffstat (limited to 'test')
-rw-r--r--test/common.js10
-rw-r--r--test/node/blocklist-dht.js4
-rw-r--r--test/node/blocklist-tracker.js4
3 files changed, 9 insertions, 9 deletions
diff --git a/test/common.js b/test/common.js
index 9ac99a1..8c30686 100644
--- a/test/common.js
+++ b/test/common.js
@@ -2,12 +2,12 @@ const os = require('os')
const fs = require('fs')
const path = require('path')
-exports.getTestPath = function (infix, infoHash) {
- let testPath
+exports.getDownloadPath = function (infix, infoHash) {
+ let downloadPath
try {
- testPath = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent', 'test')
+ downloadPath = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent', 'test')
} catch (err) {
- testPath = path.join(typeof os.tmpdir === 'function' ? os.tmpdir() : '/', 'webtorrent', 'test')
+ downloadPath = path.join(typeof os.tmpdir === 'function' ? os.tmpdir() : '/', 'webtorrent', 'test')
}
- return path.join(testPath, infix, infoHash)
+ return path.join(downloadPath, infix, infoHash)
}
diff --git a/test/node/blocklist-dht.js b/test/node/blocklist-dht.js
index d2ce9bc..fa3915a 100644
--- a/test/node/blocklist-dht.js
+++ b/test/node/blocklist-dht.js
@@ -27,7 +27,7 @@ test('blocklist blocks peers discovered via DHT', function (t) {
client1.on('warning', function (err) { t.fail(err) })
var torrent1 = client1.add(fixtures.leaves.parsedTorrent, {
- path: common.getTestPath('client_1', fixtures.leaves.parsedTorrent.infoHash)
+ path: common.getDownloadPath('client_1', fixtures.leaves.parsedTorrent.infoHash)
})
torrent1.on('peer', function () {
@@ -67,7 +67,7 @@ test('blocklist blocks peers discovered via DHT', function (t) {
client2.on('warning', function (err) { t.fail(err) })
var torrent2 = client2.add(fixtures.leaves.parsedTorrent, {
- path: common.getTestPath('client_2', fixtures.leaves.parsedTorrent.infoHash)
+ path: common.getDownloadPath('client_2', fixtures.leaves.parsedTorrent.infoHash)
})
torrent2.on('blockedPeer', function (addr) {
diff --git a/test/node/blocklist-tracker.js b/test/node/blocklist-tracker.js
index 665ad48..e877d24 100644
--- a/test/node/blocklist-tracker.js
+++ b/test/node/blocklist-tracker.js
@@ -40,7 +40,7 @@ test('blocklist blocks peers discovered via tracker', function (t) {
client1.on('warning', function (err) { t.fail(err) })
var torrent1 = client1.add(parsedTorrent, {
- path: common.getTestPath('client_1', parsedTorrent.infoHash)
+ path: common.getDownloadPath('client_1', parsedTorrent.infoHash)
})
torrent1.on('invalidPeer', function () {
@@ -62,7 +62,7 @@ test('blocklist blocks peers discovered via tracker', function (t) {
client2.on('warning', function (err) { t.fail(err) })
var torrent2 = client2.add(parsedTorrent, {
- path: common.getTestPath('client_2', parsedTorrent.infoHash)
+ path: common.getDownloadPath('client_2', parsedTorrent.infoHash)
})
torrent2.once('blockedPeer', function () {