Skip to content

Commit 4422067

Browse files
committed
test: server: check that all clients, server are destroyed
1 parent e731106 commit 4422067

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/server.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var peerId2 = Buffer.from('12345678901234567890')
1212
var peerId3 = Buffer.from('23456789012345678901')
1313

1414
function serverTest (t, serverType, serverFamily) {
15-
t.plan(36)
15+
t.plan(40)
1616

1717
var hostname = serverFamily === 'inet6'
1818
? '[::1]'
@@ -138,16 +138,23 @@ function serverTest (t, serverType, serverFamily) {
138138
t.equal(data.incomplete, 1)
139139

140140
client2.destroy(function () {
141+
t.pass('client2 destroyed')
141142
client3.stop()
142143
client3.once('update', function (data) {
143144
t.equal(data.announce, announceUrl)
144145
t.equal(data.complete, 1)
145146
t.equal(data.incomplete, 0)
146147

148+
client1.destroy(function () {
149+
t.pass('client1 destroyed')
150+
})
151+
147152
client3.destroy(function () {
148-
client1.destroy(function () {
149-
server.close()
150-
})
153+
t.pass('client3 destroyed')
154+
})
155+
156+
server.close(function () {
157+
t.pass('server destroyed')
151158
})
152159
})
153160
})

0 commit comments

Comments
 (0)