From 1424a00c3adf7a5d439555032a62257cd2467187 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 20 Jan 2017 18:33:17 -0800 Subject: [PATCH] test: don't rely on setTimeout in testClientStop() --- test/client.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/client.js b/test/client.js index 29a2897..e8b6431 100644 --- a/test/client.js +++ b/test/client.js @@ -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) + }) }) }