mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-02-07 13:59:07 +00:00
test: make large torrent test more thorough
This commit is contained in:
parent
012b31553b
commit
fe4a6720b7
@ -1,5 +1,5 @@
|
|||||||
var common = require('./common')
|
|
||||||
var Client = require('../')
|
var Client = require('../')
|
||||||
|
var common = require('./common')
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
var parseTorrent = require('parse-torrent')
|
var parseTorrent = require('parse-torrent')
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
@ -10,7 +10,7 @@ var parsedTorrent = parseTorrent(torrent)
|
|||||||
var peerId = new Buffer('01234567890123456789')
|
var peerId = new Buffer('01234567890123456789')
|
||||||
|
|
||||||
function testLargeTorrent (t, serverType) {
|
function testLargeTorrent (t, serverType) {
|
||||||
t.plan(4)
|
t.plan(9)
|
||||||
|
|
||||||
common.createServer(t, serverType, function (server, announceUrl) {
|
common.createServer(t, serverType, function (server, announceUrl) {
|
||||||
parsedTorrent.announce = [ announceUrl ]
|
parsedTorrent.announce = [ announceUrl ]
|
||||||
@ -20,6 +20,13 @@ function testLargeTorrent (t, serverType) {
|
|||||||
client.on('error', function (err) { t.error(err) })
|
client.on('error', function (err) { t.error(err) })
|
||||||
client.on('warning', function (err) { t.error(err) })
|
client.on('warning', function (err) { t.error(err) })
|
||||||
|
|
||||||
|
client.once('update', function (data) {
|
||||||
|
t.equal(data.announce, announceUrl)
|
||||||
|
t.equal(typeof data.complete, 'number')
|
||||||
|
t.equal(typeof data.incomplete, 'number')
|
||||||
|
|
||||||
|
client.update()
|
||||||
|
|
||||||
client.once('update', function (data) {
|
client.once('update', function (data) {
|
||||||
t.equal(data.announce, announceUrl)
|
t.equal(data.announce, announceUrl)
|
||||||
t.equal(typeof data.complete, 'number')
|
t.equal(typeof data.complete, 'number')
|
||||||
@ -27,12 +34,16 @@ function testLargeTorrent (t, serverType) {
|
|||||||
|
|
||||||
client.stop()
|
client.stop()
|
||||||
|
|
||||||
client.once('update', function () {
|
client.once('update', function (data) {
|
||||||
t.pass('got response to stop')
|
t.equal(data.announce, announceUrl)
|
||||||
|
t.equal(typeof data.complete, 'number')
|
||||||
|
t.equal(typeof data.incomplete, 'number')
|
||||||
|
|
||||||
server.close()
|
server.close()
|
||||||
client.destroy()
|
client.destroy()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
client.start()
|
client.start()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user