Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var peerId = '12345678901234567890'
var torrentLength = 50000

test('server', function (t) {
t.plan(21)
t.plan(23)

var server = new Server() // { interval: 50000, compactOnly: false }

Expand Down Expand Up @@ -74,15 +74,27 @@ test('server', function (t) {
t.equal(typeof data.incomplete, 'number')
t.equal(typeof data.downloaded, 'number')

client.stop()
var client2 = new Client(peerId.split('').reverse().join(''), 6882, {
infoHash: infoHash,
length: torrentLength,
announce: [ announceUrl ]
})

client2.once('peer', function (addr) {
t.equal(addr, '127.0.0.1:6881')
client2.stop()
client.stop()

client.once('update', function (data) {
t.equal(data.announce, announceUrl)
t.equal(data.complete, 0)
t.equal(data.incomplete, 0)
client.once('update', function (data) {
t.equal(data.announce, announceUrl)
t.equal(data.complete, 0)
t.equal(data.incomplete, 0)

server.close()
server.close()
})
})

client2.start()
})
})
})
Expand Down