From 945710907b9f848231e3dbb70d0467a581e083ce Mon Sep 17 00:00:00 2001 From: Pawel Kadluczka Date: Wed, 15 Nov 2017 14:06:16 -0800 Subject: [PATCH] Fixing js end-to-end test after introducing streaminvocation (#1120) Fixing js end-to-end test after introducing streaminvocation Fixing hanging tests. Adding debug parameter --- .../wwwroot/connectionTests.html | 21 +++++++++++++++---- .../wwwroot/js/hubConnectionTests.js | 13 ++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/connectionTests.html b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/connectionTests.html index 9ba5552087..f1e89e62a0 100644 --- a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/connectionTests.html +++ b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/connectionTests.html @@ -10,17 +10,30 @@ diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/hubConnectionTests.js b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/hubConnectionTests.js index 29371c8f5c..44de69c404 100644 --- a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/hubConnectionTests.js +++ b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/hubConnectionTests.js @@ -8,7 +8,6 @@ var TESTHUBENDPOINT_URL = '/testhub'; describe('hubConnection', function () { eachTransportAndProtocol(function (transportType, protocol) { describe(protocol.name + ' over ' + signalR.TransportType[transportType] + ' transport', function () { - it('can invoke server method and receive result', function (done) { var message = '你好,世界!'; @@ -138,7 +137,7 @@ describe('hubConnection', function () { // exception expected but none thrown fail(); }).catch(function (e) { - expect(e.message).toBe('Streaming methods must be invoked using the \'HubConnection.stream()\' method.'); + expect(e.message).toBe('The client attempted to invoke the streaming \'EmptyStream\' method in a non-streaming fashion.'); }).then(function () { return hubConnection.stop(); }).then(function () { @@ -163,7 +162,7 @@ describe('hubConnection', function () { // exception expected but none thrown fail(); }).catch(function (e) { - expect(e.message).toBe('Streaming methods must be invoked using the \'HubConnection.stream()\' method.'); + expect(e.message).toBe('The client attempted to invoke the streaming \'Stream\' method in a non-streaming fashion.'); }).then(function () { return hubConnection.stop(); }).then(function () { @@ -187,13 +186,16 @@ describe('hubConnection', function () { hubConnection.start().then(function () { hubConnection.stream('StreamThrowException', errorMessage).subscribe({ next: function next(item) { + hubConnection.stop(); fail(); }, error: function error(err) { expect(err.message).toEqual('An error occurred.'); + hubConnection.stop(); done(); }, complete: function complete() { + hubConnection.stop(); fail(); } }); @@ -214,13 +216,16 @@ describe('hubConnection', function () { hubConnection.start().then(function () { hubConnection.stream('Echo', '42').subscribe({ next: function next(item) { + hubConnection.stop(); fail(); }, error: function error(err) { - expect(err.message).toEqual('Hub methods must be invoked using the \'HubConnection.invoke()\' method.'); + expect(err.message).toEqual('The client attempted to invoke the non-streaming \'Echo\' method in a streaming fashion.'); + hubConnection.stop(); done(); }, complete: function complete() { + hubConnection.stop(); fail(); } });