mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 20:21:36 +00:00
#11 add failing test
This commit is contained in:
parent
b0a659f00c
commit
a924e620e1
32
test/client-large-torrent.js
Normal file
32
test/client-large-torrent.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
var Client = require('../').Client
|
||||||
|
var fs = require('fs')
|
||||||
|
var parseTorrent = require('parse-torrent')
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
var torrent = fs.readFileSync(__dirname + '/torrents/sintel-5gb.torrent')
|
||||||
|
var parsedTorrent = parseTorrent(torrent)
|
||||||
|
var peerId = new Buffer('01234567890123456789')
|
||||||
|
var port = 6881
|
||||||
|
|
||||||
|
test('client.start()', function (t) {
|
||||||
|
t.plan(4)
|
||||||
|
|
||||||
|
var client = new Client(peerId, port, parsedTorrent)
|
||||||
|
|
||||||
|
client.on('error', function (err) {
|
||||||
|
t.error(err)
|
||||||
|
})
|
||||||
|
|
||||||
|
client.once('update', function (data) {
|
||||||
|
t.equal(data.announce, 'http://t.bitlove.org/announce')
|
||||||
|
t.equal(typeof data.complete, 'number')
|
||||||
|
t.equal(typeof data.incomplete, 'number')
|
||||||
|
})
|
||||||
|
|
||||||
|
client.once('peer', function (addr) {
|
||||||
|
t.pass('there is at least one peer') // TODO: this shouldn't rely on an external server!
|
||||||
|
client.stop()
|
||||||
|
})
|
||||||
|
|
||||||
|
client.start()
|
||||||
|
})
|
BIN
test/torrents/sintel-5gb.torrent
Normal file
BIN
test/torrents/sintel-5gb.torrent
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user