2022-12-05 22:06:54 +00:00
|
|
|
import bencode from 'bencode'
|
|
|
|
import Client from '../index.js'
|
|
|
|
import common from './common.js'
|
|
|
|
import commonLib from '../lib/common.js'
|
|
|
|
import fixtures from 'webtorrent-fixtures'
|
2023-10-31 09:51:04 +00:00
|
|
|
import fetch from 'cross-fetch-ponyfill'
|
2022-12-05 22:06:54 +00:00
|
|
|
import test from 'tape'
|
2023-05-26 16:54:30 +00:00
|
|
|
import { hex2bin } from 'uint8-util'
|
2014-07-11 04:30:30 +00:00
|
|
|
|
2020-10-29 04:57:47 +00:00
|
|
|
const peerId = Buffer.from('01234567890123456789')
|
2014-07-11 04:30:30 +00:00
|
|
|
|
2014-07-22 05:58:13 +00:00
|
|
|
function testSingle (t, serverType) {
|
2022-12-05 22:06:54 +00:00
|
|
|
common.createServer(t, serverType, (server, announceUrl) => {
|
2020-10-29 04:57:47 +00:00
|
|
|
const client = new Client({
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
infoHash: fixtures.leaves.parsedTorrent.infoHash,
|
|
|
|
announce: announceUrl,
|
2020-04-25 09:34:40 +00:00
|
|
|
peerId,
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
port: 6881,
|
|
|
|
wrtc: {}
|
2015-05-02 00:36:07 +00:00
|
|
|
})
|
|
|
|
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
if (serverType === 'ws') common.mockWebsocketTracker(client)
|
2021-06-15 01:54:41 +00:00
|
|
|
client.on('error', err => { t.error(err) })
|
|
|
|
client.on('warning', err => { t.error(err) })
|
2015-05-02 00:36:07 +00:00
|
|
|
|
|
|
|
client.scrape()
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
client.on('scrape', data => {
|
2015-01-29 22:59:08 +00:00
|
|
|
t.equal(data.announce, announceUrl)
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
t.equal(data.infoHash, fixtures.leaves.parsedTorrent.infoHash)
|
2015-01-29 22:59:08 +00:00
|
|
|
t.equal(typeof data.complete, 'number')
|
|
|
|
t.equal(typeof data.incomplete, 'number')
|
|
|
|
t.equal(typeof data.downloaded, 'number')
|
2015-05-17 06:24:20 +00:00
|
|
|
client.destroy()
|
2021-06-15 01:54:41 +00:00
|
|
|
server.close(() => {
|
2015-01-29 22:59:08 +00:00
|
|
|
t.end()
|
2014-07-22 05:58:13 +00:00
|
|
|
})
|
|
|
|
})
|
2014-07-11 04:30:30 +00:00
|
|
|
})
|
2014-07-22 05:58:13 +00:00
|
|
|
}
|
2014-07-11 04:30:30 +00:00
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('http: single info_hash scrape', t => {
|
2014-07-22 05:58:13 +00:00
|
|
|
testSingle(t, 'http')
|
|
|
|
})
|
2014-07-11 04:30:30 +00:00
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('udp: single info_hash scrape', t => {
|
2014-07-22 05:58:13 +00:00
|
|
|
testSingle(t, 'udp')
|
|
|
|
})
|
2014-07-11 04:30:30 +00:00
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('ws: single info_hash scrape', t => {
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
testSingle(t, 'ws')
|
|
|
|
})
|
|
|
|
|
2014-07-22 05:58:13 +00:00
|
|
|
function clientScrapeStatic (t, serverType) {
|
2022-12-05 22:06:54 +00:00
|
|
|
common.createServer(t, serverType, (server, announceUrl) => {
|
2020-10-29 04:57:47 +00:00
|
|
|
const client = Client.scrape({
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
announce: announceUrl,
|
|
|
|
infoHash: fixtures.leaves.parsedTorrent.infoHash,
|
|
|
|
wrtc: {}
|
2021-06-15 01:54:41 +00:00
|
|
|
}, (err, data) => {
|
2015-01-29 22:59:08 +00:00
|
|
|
t.error(err)
|
|
|
|
t.equal(data.announce, announceUrl)
|
2016-03-16 19:22:33 +00:00
|
|
|
t.equal(data.infoHash, fixtures.leaves.parsedTorrent.infoHash)
|
2015-01-29 22:59:08 +00:00
|
|
|
t.equal(typeof data.complete, 'number')
|
|
|
|
t.equal(typeof data.incomplete, 'number')
|
|
|
|
t.equal(typeof data.downloaded, 'number')
|
2021-06-15 01:54:41 +00:00
|
|
|
server.close(() => {
|
2015-01-29 22:59:08 +00:00
|
|
|
t.end()
|
2014-07-11 04:30:30 +00:00
|
|
|
})
|
|
|
|
})
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
if (serverType === 'ws') common.mockWebsocketTracker(client)
|
2014-07-11 04:30:30 +00:00
|
|
|
})
|
2014-07-22 05:58:13 +00:00
|
|
|
}
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('http: scrape using Client.scrape static method', t => {
|
2014-07-22 05:58:13 +00:00
|
|
|
clientScrapeStatic(t, 'http')
|
|
|
|
})
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('udp: scrape using Client.scrape static method', t => {
|
2014-07-22 05:58:13 +00:00
|
|
|
clientScrapeStatic(t, 'udp')
|
2014-07-11 04:30:30 +00:00
|
|
|
})
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('ws: scrape using Client.scrape static method', t => {
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
clientScrapeStatic(t, 'ws')
|
|
|
|
})
|
|
|
|
|
2016-08-06 01:23:43 +00:00
|
|
|
// Ensure the callback function gets called when an invalid url is passed
|
|
|
|
function clientScrapeStaticInvalid (t, serverType) {
|
2021-06-15 01:54:41 +00:00
|
|
|
let announceUrl = `${serverType}://invalid.lol`
|
2016-08-06 01:23:43 +00:00
|
|
|
if (serverType === 'http') announceUrl += '/announce'
|
|
|
|
|
2020-10-29 04:57:47 +00:00
|
|
|
const client = Client.scrape({
|
2016-08-06 01:23:43 +00:00
|
|
|
announce: announceUrl,
|
|
|
|
infoHash: fixtures.leaves.parsedTorrent.infoHash,
|
|
|
|
wrtc: {}
|
2021-06-15 01:54:41 +00:00
|
|
|
}, (err, data) => {
|
2016-08-06 01:23:43 +00:00
|
|
|
t.ok(err instanceof Error)
|
|
|
|
t.end()
|
|
|
|
})
|
|
|
|
if (serverType === 'ws') common.mockWebsocketTracker(client)
|
|
|
|
}
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('http: scrape using Client.scrape static method (invalid url)', t => {
|
2016-08-06 01:23:43 +00:00
|
|
|
clientScrapeStaticInvalid(t, 'http')
|
|
|
|
})
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('udp: scrape using Client.scrape static method (invalid url)', t => {
|
2016-08-06 01:23:43 +00:00
|
|
|
clientScrapeStaticInvalid(t, 'udp')
|
|
|
|
})
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('ws: scrape using Client.scrape static method (invalid url)', t => {
|
2016-08-06 01:23:43 +00:00
|
|
|
clientScrapeStaticInvalid(t, 'ws')
|
|
|
|
})
|
|
|
|
|
2015-05-02 00:36:07 +00:00
|
|
|
function clientScrapeMulti (t, serverType) {
|
2020-10-29 04:57:47 +00:00
|
|
|
const infoHash1 = fixtures.leaves.parsedTorrent.infoHash
|
|
|
|
const infoHash2 = fixtures.alice.parsedTorrent.infoHash
|
2016-03-16 19:22:33 +00:00
|
|
|
|
2022-12-05 22:06:54 +00:00
|
|
|
common.createServer(t, serverType, (server, announceUrl) => {
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
Client.scrape({
|
2019-07-05 21:36:14 +00:00
|
|
|
infoHash: [infoHash1, infoHash2],
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
announce: announceUrl
|
2021-06-15 01:54:41 +00:00
|
|
|
}, (err, results) => {
|
2015-05-02 00:36:07 +00:00
|
|
|
t.error(err)
|
|
|
|
|
|
|
|
t.equal(results[infoHash1].announce, announceUrl)
|
2015-12-02 23:35:42 +00:00
|
|
|
t.equal(results[infoHash1].infoHash, infoHash1)
|
2015-05-02 00:36:07 +00:00
|
|
|
t.equal(typeof results[infoHash1].complete, 'number')
|
|
|
|
t.equal(typeof results[infoHash1].incomplete, 'number')
|
|
|
|
t.equal(typeof results[infoHash1].downloaded, 'number')
|
|
|
|
|
|
|
|
t.equal(results[infoHash2].announce, announceUrl)
|
2015-12-02 23:35:42 +00:00
|
|
|
t.equal(results[infoHash2].infoHash, infoHash2)
|
2015-05-02 00:36:07 +00:00
|
|
|
t.equal(typeof results[infoHash2].complete, 'number')
|
|
|
|
t.equal(typeof results[infoHash2].incomplete, 'number')
|
|
|
|
t.equal(typeof results[infoHash2].downloaded, 'number')
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
server.close(() => {
|
2015-05-02 00:36:07 +00:00
|
|
|
t.end()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('http: MULTI scrape using Client.scrape static method', t => {
|
2015-05-02 00:36:07 +00:00
|
|
|
clientScrapeMulti(t, 'http')
|
|
|
|
})
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('udp: MULTI scrape using Client.scrape static method', t => {
|
2015-05-02 00:36:07 +00:00
|
|
|
clientScrapeMulti(t, 'udp')
|
|
|
|
})
|
2014-07-22 05:58:13 +00:00
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('server: multiple info_hash scrape (manual http request)', t => {
|
2023-10-31 09:51:04 +00:00
|
|
|
t.plan(12)
|
2016-03-01 01:55:31 +00:00
|
|
|
|
2023-05-26 16:54:30 +00:00
|
|
|
const binaryInfoHash1 = hex2bin(fixtures.leaves.parsedTorrent.infoHash)
|
|
|
|
const binaryInfoHash2 = hex2bin(fixtures.alice.parsedTorrent.infoHash)
|
2016-03-16 19:22:33 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
common.createServer(t, 'http', async (server, announceUrl) => {
|
2020-10-29 04:57:47 +00:00
|
|
|
const scrapeUrl = announceUrl.replace('/announce', '/scrape')
|
2014-07-11 04:30:30 +00:00
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
const url = `${scrapeUrl}?${commonLib.querystringStringify({
|
|
|
|
info_hash: [binaryInfoHash1, binaryInfoHash2]
|
|
|
|
})}`
|
2023-10-31 09:51:04 +00:00
|
|
|
let res
|
|
|
|
try {
|
|
|
|
res = await fetch(url)
|
|
|
|
} catch (err) {
|
2016-03-01 01:55:31 +00:00
|
|
|
t.error(err)
|
2023-10-31 09:51:04 +00:00
|
|
|
}
|
|
|
|
let data = Buffer.from(await res.arrayBuffer())
|
2016-03-01 01:55:31 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
t.equal(res.status, 200)
|
2015-01-29 22:59:08 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
data = bencode.decode(data)
|
|
|
|
t.ok(data.files)
|
|
|
|
t.equal(Object.keys(data.files).length, 2)
|
2015-01-29 22:59:08 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
t.ok(data.files[binaryInfoHash1])
|
|
|
|
t.equal(typeof data.files[binaryInfoHash1].complete, 'number')
|
|
|
|
t.equal(typeof data.files[binaryInfoHash1].incomplete, 'number')
|
|
|
|
t.equal(typeof data.files[binaryInfoHash1].downloaded, 'number')
|
2015-01-29 22:59:08 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
t.ok(data.files[binaryInfoHash2])
|
|
|
|
t.equal(typeof data.files[binaryInfoHash2].complete, 'number')
|
|
|
|
t.equal(typeof data.files[binaryInfoHash2].incomplete, 'number')
|
|
|
|
t.equal(typeof data.files[binaryInfoHash2].downloaded, 'number')
|
2015-01-29 22:59:08 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
server.close(() => { t.pass('server closed') })
|
2014-07-11 04:30:30 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-06-15 01:54:41 +00:00
|
|
|
test('server: all info_hash scrape (manual http request)', t => {
|
2023-10-31 09:51:04 +00:00
|
|
|
t.plan(9)
|
2016-03-16 19:22:33 +00:00
|
|
|
|
2023-05-26 16:54:30 +00:00
|
|
|
const binaryInfoHash = hex2bin(fixtures.leaves.parsedTorrent.infoHash)
|
2016-03-16 19:22:33 +00:00
|
|
|
|
2022-12-05 22:06:54 +00:00
|
|
|
common.createServer(t, 'http', (server, announceUrl) => {
|
2020-10-29 04:57:47 +00:00
|
|
|
const scrapeUrl = announceUrl.replace('/announce', '/scrape')
|
2014-07-11 04:30:30 +00:00
|
|
|
|
2015-01-29 22:59:08 +00:00
|
|
|
// announce a torrent to the tracker
|
2020-10-29 04:57:47 +00:00
|
|
|
const client = new Client({
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
infoHash: fixtures.leaves.parsedTorrent.infoHash,
|
|
|
|
announce: announceUrl,
|
2020-04-25 09:34:40 +00:00
|
|
|
peerId,
|
BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118. Fixes #115.
Added ws tests for scrape.
2016-04-01 04:37:51 +00:00
|
|
|
port: 6881
|
|
|
|
})
|
2021-06-15 01:54:41 +00:00
|
|
|
client.on('error', err => { t.error(err) })
|
|
|
|
client.on('warning', err => { t.error(err) })
|
2016-03-01 01:55:31 +00:00
|
|
|
|
2015-01-29 22:59:08 +00:00
|
|
|
client.start()
|
2015-01-29 20:24:17 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
server.once('start', async () => {
|
2015-01-29 22:59:08 +00:00
|
|
|
// now do a scrape of everything by omitting the info_hash param
|
2023-10-31 09:51:04 +00:00
|
|
|
let res
|
|
|
|
try {
|
|
|
|
res = await fetch(scrapeUrl)
|
|
|
|
} catch (err) {
|
2016-03-01 01:55:31 +00:00
|
|
|
t.error(err)
|
2023-10-31 09:51:04 +00:00
|
|
|
}
|
|
|
|
let data = Buffer.from(await res.arrayBuffer())
|
2015-01-29 20:24:17 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
t.equal(res.status, 200)
|
|
|
|
data = bencode.decode(data)
|
|
|
|
t.ok(data.files)
|
|
|
|
t.equal(Object.keys(data.files).length, 1)
|
2015-01-29 20:24:17 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
t.ok(data.files[binaryInfoHash])
|
|
|
|
t.equal(typeof data.files[binaryInfoHash].complete, 'number')
|
|
|
|
t.equal(typeof data.files[binaryInfoHash].incomplete, 'number')
|
|
|
|
t.equal(typeof data.files[binaryInfoHash].downloaded, 'number')
|
2015-01-29 20:24:17 +00:00
|
|
|
|
2023-10-31 09:51:04 +00:00
|
|
|
client.destroy(() => { t.pass('client destroyed') })
|
|
|
|
server.close(() => { t.pass('server closed') })
|
2015-01-29 20:24:17 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|