mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 12:11:36 +00:00
test: don't rely on setTimeout in testClientStop()
This commit is contained in:
parent
ee45b7947b
commit
1424a00c3a
@ -56,7 +56,7 @@ test('ws: client.start()', function (t) {
|
||||
})
|
||||
|
||||
function testClientStop (t, serverType) {
|
||||
t.plan(3)
|
||||
t.plan(4)
|
||||
|
||||
common.createServer(t, serverType, function (server, announceUrl) {
|
||||
var client = new Client({
|
||||
@ -73,7 +73,9 @@ function testClientStop (t, serverType) {
|
||||
|
||||
client.start()
|
||||
|
||||
setTimeout(function () {
|
||||
client.once('update', function () {
|
||||
t.pass('client received response to "start" message')
|
||||
|
||||
client.stop()
|
||||
|
||||
client.once('update', function (data) {
|
||||
@ -85,7 +87,7 @@ function testClientStop (t, serverType) {
|
||||
server.close()
|
||||
client.destroy()
|
||||
})
|
||||
}, 1000)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user