Register callback before start (#4581)

This commit is contained in:
BrennanConroy 2018-12-13 21:30:48 -08:00 committed by GitHub
parent 4950495dc4
commit 74dbb4ff4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -634,16 +634,16 @@ describe("hubConnection", () => {
}); });
if (transportType !== HttpTransportType.LongPolling) { 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(); const hubConnection = getConnectionBuilder(transportType).build();
hubConnection.serverTimeoutInMilliseconds = 100; hubConnection.serverTimeoutInMilliseconds = 100;
hubConnection.start().then(() => { hubConnection.onclose((error) => {
hubConnection.onclose((error) => { expect(error).toEqual(new Error("Server timeout elapsed without receiving a message from the server."));
expect(error).toEqual(new Error("Server timeout elapsed without receiving a message from the server.")); done();
done();
});
}); });
await hubConnection.start();
}); });
} }