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
This commit is contained in:
parent
3a8f512fa7
commit
945710907b
|
|
@ -10,17 +10,30 @@
|
||||||
<script type="text/javascript" src="lib/jasmine/jasmine-html.js"></script>
|
<script type="text/javascript" src="lib/jasmine/jasmine-html.js"></script>
|
||||||
<script type="text/javascript" src="lib/jasmine/boot.js"></script>
|
<script type="text/javascript" src="lib/jasmine/boot.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
function getParameterByName(name, url) {
|
||||||
|
if (!url) {
|
||||||
|
url = window.location.href;
|
||||||
|
}
|
||||||
|
name = name.replace(/[\[\]]/g, "\\$&");
|
||||||
|
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
||||||
|
results = regex.exec(url);
|
||||||
|
if (!results) return null;
|
||||||
|
if (!results[2]) return '';
|
||||||
|
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
||||||
|
}
|
||||||
|
|
||||||
|
var minified = getParameterByName('debug') !== 'true' ? '.min' : '';
|
||||||
if (typeof Promise === 'undefined')
|
if (typeof Promise === 'undefined')
|
||||||
{
|
{
|
||||||
document.write(
|
document.write(
|
||||||
'<script type="text/javascript" src="lib/signalr/signalr-clientES5.min.js"><\/script>' +
|
'<script type="text/javascript" src="lib/signalr/signalr-clientES5' + minified + '.js"><\/script>' +
|
||||||
'<script type="text/javascript" src="lib/signalr/signalr-msgpackprotocolES5.min.js"><\/script>');
|
'<script type="text/javascript" src="lib/signalr/signalr-msgpackprotocolES5' + minified + '.js"><\/script>');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
document.write(
|
document.write(
|
||||||
'<script type="text/javascript" src="lib/signalr/signalr-client.min.js"><\/script>' +
|
'<script type="text/javascript" src="lib/signalr/signalr-client' + minified + '.js"><\/script>' +
|
||||||
'<script type="text/javascript" src="lib/signalr/signalr-msgpackprotocol.min.js"><\/script>');
|
'<script type="text/javascript" src="lib/signalr/signalr-msgpackprotocol' + minified + '.js"><\/script>');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ var TESTHUBENDPOINT_URL = '/testhub';
|
||||||
describe('hubConnection', function () {
|
describe('hubConnection', function () {
|
||||||
eachTransportAndProtocol(function (transportType, protocol) {
|
eachTransportAndProtocol(function (transportType, protocol) {
|
||||||
describe(protocol.name + ' over ' + signalR.TransportType[transportType] + ' transport', function () {
|
describe(protocol.name + ' over ' + signalR.TransportType[transportType] + ' transport', function () {
|
||||||
|
|
||||||
it('can invoke server method and receive result', function (done) {
|
it('can invoke server method and receive result', function (done) {
|
||||||
var message = '你好,世界!';
|
var message = '你好,世界!';
|
||||||
|
|
||||||
|
|
@ -138,7 +137,7 @@ describe('hubConnection', function () {
|
||||||
// exception expected but none thrown
|
// exception expected but none thrown
|
||||||
fail();
|
fail();
|
||||||
}).catch(function (e) {
|
}).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 () {
|
}).then(function () {
|
||||||
return hubConnection.stop();
|
return hubConnection.stop();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
|
@ -163,7 +162,7 @@ describe('hubConnection', function () {
|
||||||
// exception expected but none thrown
|
// exception expected but none thrown
|
||||||
fail();
|
fail();
|
||||||
}).catch(function (e) {
|
}).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 () {
|
}).then(function () {
|
||||||
return hubConnection.stop();
|
return hubConnection.stop();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
|
@ -187,13 +186,16 @@ describe('hubConnection', function () {
|
||||||
hubConnection.start().then(function () {
|
hubConnection.start().then(function () {
|
||||||
hubConnection.stream('StreamThrowException', errorMessage).subscribe({
|
hubConnection.stream('StreamThrowException', errorMessage).subscribe({
|
||||||
next: function next(item) {
|
next: function next(item) {
|
||||||
|
hubConnection.stop();
|
||||||
fail();
|
fail();
|
||||||
},
|
},
|
||||||
error: function error(err) {
|
error: function error(err) {
|
||||||
expect(err.message).toEqual('An error occurred.');
|
expect(err.message).toEqual('An error occurred.');
|
||||||
|
hubConnection.stop();
|
||||||
done();
|
done();
|
||||||
},
|
},
|
||||||
complete: function complete() {
|
complete: function complete() {
|
||||||
|
hubConnection.stop();
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -214,13 +216,16 @@ describe('hubConnection', function () {
|
||||||
hubConnection.start().then(function () {
|
hubConnection.start().then(function () {
|
||||||
hubConnection.stream('Echo', '42').subscribe({
|
hubConnection.stream('Echo', '42').subscribe({
|
||||||
next: function next(item) {
|
next: function next(item) {
|
||||||
|
hubConnection.stop();
|
||||||
fail();
|
fail();
|
||||||
},
|
},
|
||||||
error: function error(err) {
|
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();
|
done();
|
||||||
},
|
},
|
||||||
complete: function complete() {
|
complete: function complete() {
|
||||||
|
hubConnection.stop();
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue