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>2015-02-08 05:18:07 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-02-08 05:18:07 +0300
commite0af2a8c79f7cffa33ac0edc46fdbced84d8df22 (patch)
tree1e92c902e8bd4dbbe3d8319960559ca424d17339 /test/basic-node.js
parent89e119545ac7d2fc8dffc290a864d474027c2d72 (diff)
remove portfinder dep
Diffstat (limited to 'test/basic-node.js')
-rw-r--r--test/basic-node.js21
1 files changed, 9 insertions, 12 deletions
diff --git a/test/basic-node.js b/test/basic-node.js
index c6082aa..1692f7a 100644
--- a/test/basic-node.js
+++ b/test/basic-node.js
@@ -2,7 +2,6 @@ var WebTorrent = require('../')
var fs = require('fs')
var http = require('http')
var parseTorrent = require('parse-torrent')
-var portfinder = require('portfinder')
var test = require('tape')
var leavesPath = __dirname + '/torrents/leaves.torrent'
@@ -20,17 +19,15 @@ test('client.add (http url to a torrent file (string))', function (t) {
res.end(leaves)
})
- portfinder.getPort(function (err, port) {
- if (err) throw err
- server.listen(port, function () {
- var url = 'http://127.0.0.1:' + port
- var client = new WebTorrent({ dht: false, tracker: false })
- client.add(url, function (torrent) {
- t.equal(torrent.infoHash, leavesTorrent.infoHash)
- t.equal(torrent.magnetURI, leavesMagnetURI)
- client.destroy()
- server.close()
- })
+ server.listen(0, function () {
+ var port = server.address().port
+ var url = 'http://127.0.0.1:' + port
+ var client = new WebTorrent({ dht: false, tracker: false })
+ client.add(url, function (torrent) {
+ t.equal(torrent.infoHash, leavesTorrent.infoHash)
+ t.equal(torrent.magnetURI, leavesMagnetURI)
+ client.destroy()
+ server.close()
})
})
})