From 74dbb4ff4f380f093981c97c88a8c80d687db7e7 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Thu, 13 Dec 2018 21:30:48 -0800 Subject: [PATCH] Register callback before start (#4581) --- .../ts/FunctionalTests/ts/HubConnectionTests.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SignalR/clients/ts/FunctionalTests/ts/HubConnectionTests.ts b/src/SignalR/clients/ts/FunctionalTests/ts/HubConnectionTests.ts index 99944c1da2..e212ad9a7f 100644 --- a/src/SignalR/clients/ts/FunctionalTests/ts/HubConnectionTests.ts +++ b/src/SignalR/clients/ts/FunctionalTests/ts/HubConnectionTests.ts @@ -634,16 +634,16 @@ describe("hubConnection", () => { }); if (transportType !== HttpTransportType.LongPolling) { - it("terminates if no messages received within timeout interval", (done) => { + it("terminates if no messages received within timeout interval", async (done) => { const hubConnection = getConnectionBuilder(transportType).build(); hubConnection.serverTimeoutInMilliseconds = 100; - hubConnection.start().then(() => { - hubConnection.onclose((error) => { - expect(error).toEqual(new Error("Server timeout elapsed without receiving a message from the server.")); - done(); - }); + hubConnection.onclose((error) => { + expect(error).toEqual(new Error("Server timeout elapsed without receiving a message from the server.")); + done(); }); + + await hubConnection.start(); }); }