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>2018-02-18 04:15:39 +0300
committerFeross Aboukhadijeh <feross@feross.org>2018-02-18 04:15:42 +0300
commitc29e02ce29245cba2b198a3b5da533d961118fb8 (patch)
tree32617d9a3794929f0bafbbcd3a6a1f0b4829805c /test
parentb89afaa647dba9587c5cd49d11b964fc5dba811a (diff)
standard
Diffstat (limited to 'test')
-rw-r--r--test/node/blocklist.js140
1 files changed, 70 insertions, 70 deletions
diff --git a/test/node/blocklist.js b/test/node/blocklist.js
index d67af91..f39b232 100644
--- a/test/node/blocklist.js
+++ b/test/node/blocklist.js
@@ -53,22 +53,22 @@ test('blocklist (array of IPs)', function (t) {
tracker: false,
blocklist: [ '1.2.3.4', '5.6.7.8' ]
})
- .on('error', function (err) { t.fail(err) })
- .on('warning', function (err) { t.fail(err) })
- .on('ready', function () {
- client.add(fixtures.leaves.parsedTorrent, function (torrent) {
- assertBlocked(t, torrent, '1.2.3.4:1234')
- assertBlocked(t, torrent, '1.2.3.4:6969')
- assertBlocked(t, torrent, '5.6.7.8:1234')
- assertBlocked(t, torrent, '5.6.7.8:6969')
- assertReachable(t, torrent, '1.1.1.1:1234')
- assertReachable(t, torrent, '1.1.1.1:6969')
+ .on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
+ .on('ready', function () {
+ client.add(fixtures.leaves.parsedTorrent, function (torrent) {
+ assertBlocked(t, torrent, '1.2.3.4:1234')
+ assertBlocked(t, torrent, '1.2.3.4:6969')
+ assertBlocked(t, torrent, '5.6.7.8:1234')
+ assertBlocked(t, torrent, '5.6.7.8:6969')
+ assertReachable(t, torrent, '1.1.1.1:1234')
+ assertReachable(t, torrent, '1.1.1.1:6969')
- client.destroy(function (err) {
- t.error(err, 'client destroyed')
+ client.destroy(function (err) {
+ t.error(err, 'client destroyed')
+ })
})
})
- })
})
// 48 asserts
@@ -120,16 +120,16 @@ test('blocklist (array of IP ranges)', function (t) {
{ start: '5.6.7.0', end: '5.6.7.255' }
]
})
- .on('error', function (err) { t.fail(err) })
- .on('warning', function (err) { t.fail(err) })
- .on('ready', function () {
- client.add(fixtures.leaves.parsedTorrent, function (torrent) {
- assertList(t, torrent)
- client.destroy(function (err) {
- t.error(err, 'client destroyed')
+ .on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
+ .on('ready', function () {
+ client.add(fixtures.leaves.parsedTorrent, function (torrent) {
+ assertList(t, torrent)
+ client.destroy(function (err) {
+ t.error(err, 'client destroyed')
+ })
})
})
- })
})
test('blocklist (http url)', function (t) {
@@ -149,19 +149,19 @@ test('blocklist (http url)', function (t) {
tracker: false,
blocklist: url
})
- .on('error', function (err) { t.fail(err) })
- .on('warning', function (err) { t.fail(err) })
- .on('ready', function () {
- client.add(fixtures.leaves.parsedTorrent, function (torrent) {
- assertList(t, torrent)
- client.destroy(function (err) {
- t.error(err, 'client destroyed')
- })
- server.close(function () {
- t.pass('server closed')
+ .on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
+ .on('ready', function () {
+ client.add(fixtures.leaves.parsedTorrent, function (torrent) {
+ assertList(t, torrent)
+ client.destroy(function (err) {
+ t.error(err, 'client destroyed')
+ })
+ server.close(function () {
+ t.pass('server closed')
+ })
})
})
- })
})
})
@@ -185,19 +185,19 @@ test('blocklist (http url with gzip encoding)', function (t) {
tracker: false,
blocklist: url
})
- .on('error', function (err) { t.fail(err) })
- .on('warning', function (err) { t.fail(err) })
- .on('ready', function () {
- client.add(fixtures.leaves.parsedTorrent, function (torrent) {
- assertList(t, torrent)
- client.destroy(function (err) {
- t.error(err, 'client destroyed')
- })
- server.close(function () {
- t.pass('server closed')
+ .on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
+ .on('ready', function () {
+ client.add(fixtures.leaves.parsedTorrent, function (torrent) {
+ assertList(t, torrent)
+ client.destroy(function (err) {
+ t.error(err, 'client destroyed')
+ })
+ server.close(function () {
+ t.pass('server closed')
+ })
})
})
- })
})
})
@@ -221,19 +221,19 @@ test('blocklist (http url with deflate encoding)', function (t) {
tracker: false,
blocklist: url
})
- .on('error', function (err) { t.fail(err) })
- .on('warning', function (err) { t.fail(err) })
- .on('ready', function () {
- client.add(fixtures.leaves.parsedTorrent, function (torrent) {
- assertList(t, torrent)
- client.destroy(function (err) {
- t.error(err, 'client destroyed')
- })
- server.close(function () {
- t.pass('server closed')
+ .on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
+ .on('ready', function () {
+ client.add(fixtures.leaves.parsedTorrent, function (torrent) {
+ assertList(t, torrent)
+ client.destroy(function (err) {
+ t.error(err, 'client destroyed')
+ })
+ server.close(function () {
+ t.pass('server closed')
+ })
})
})
- })
})
})
@@ -244,16 +244,16 @@ test('blocklist (fs path)', function (t) {
tracker: false,
blocklist: fixtures.blocklist.path
})
- .on('error', function (err) { t.fail(err) })
- .on('warning', function (err) { t.fail(err) })
- .on('ready', function () {
- client.add(fixtures.leaves.parsedTorrent, function (torrent) {
- assertList(t, torrent)
- client.destroy(function (err) {
- t.error(err, 'client destroyed')
+ .on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
+ .on('ready', function () {
+ client.add(fixtures.leaves.parsedTorrent, function (torrent) {
+ assertList(t, torrent)
+ client.destroy(function (err) {
+ t.error(err, 'client destroyed')
+ })
})
})
- })
})
test('blocklist (fs path with gzip)', function (t) {
@@ -263,14 +263,14 @@ test('blocklist (fs path with gzip)', function (t) {
tracker: false,
blocklist: fixtures.blocklist.gzipPath
})
- .on('error', function (err) { t.fail(err) })
- .on('warning', function (err) { t.fail(err) })
- .on('ready', function () {
- client.add(fixtures.leaves.parsedTorrent, function (torrent) {
- assertList(t, torrent)
- client.destroy(function (err) {
- t.error(err, 'client destroyed')
+ .on('error', function (err) { t.fail(err) })
+ .on('warning', function (err) { t.fail(err) })
+ .on('ready', function () {
+ client.add(fixtures.leaves.parsedTorrent, function (torrent) {
+ assertList(t, torrent)
+ client.destroy(function (err) {
+ t.error(err, 'client destroyed')
+ })
})
})
- })
})