Skip to content

Commit 55120f5

Browse files
committed
added a failing test
1 parent 7b5be63 commit 55120f5

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

test/server.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var peerId = '12345678901234567890'
1111
var torrentLength = 50000
1212

1313
test('server', function (t) {
14-
t.plan(21)
14+
t.plan(22)
1515

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

@@ -74,15 +74,26 @@ test('server', function (t) {
7474
t.equal(typeof data.incomplete, 'number')
7575
t.equal(typeof data.downloaded, 'number')
7676

77-
client.stop()
77+
var client2 = new Client(peerId.split('').reverse().join(''), 6882, {
78+
infoHash: infoHash,
79+
length: torrentLength,
80+
announce: [ announceUrl ]
81+
})
82+
83+
client2.once('peer', function (addr) {
84+
t.equal(addr, '127.0.0.1:6881')
85+
client.stop()
7886

79-
client.once('update', function (data) {
80-
t.equal(data.announce, announceUrl)
81-
t.equal(data.complete, 0)
82-
t.equal(data.incomplete, 0)
87+
client.once('update', function (data) {
88+
t.equal(data.announce, announceUrl)
89+
t.equal(data.complete, 0)
90+
t.equal(data.incomplete, 0)
8391

84-
server.close()
92+
server.close()
93+
})
8594
})
95+
96+
client2.start()
8697
})
8798
})
8899
})

0 commit comments

Comments
 (0)