Skip to content

Commit 1424a00

Browse files
committed
test: don't rely on setTimeout in testClientStop()
1 parent ee45b79 commit 1424a00

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/client.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test('ws: client.start()', function (t) {
5656
})
5757

5858
function testClientStop (t, serverType) {
59-
t.plan(3)
59+
t.plan(4)
6060

6161
common.createServer(t, serverType, function (server, announceUrl) {
6262
var client = new Client({
@@ -73,7 +73,9 @@ function testClientStop (t, serverType) {
7373

7474
client.start()
7575

76-
setTimeout(function () {
76+
client.once('update', function () {
77+
t.pass('client received response to "start" message')
78+
7779
client.stop()
7880

7981
client.once('update', function (data) {
@@ -85,7 +87,7 @@ function testClientStop (t, serverType) {
8587
server.close()
8688
client.destroy()
8789
})
88-
}, 1000)
90+
})
8991
})
9092
}
9193

0 commit comments

Comments
 (0)