Skip to content

Commit b147142

Browse files
committed
type
1 parent 3b23aa9 commit b147142

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/SignalR/clients/ts/signalr/tests/MessageSize.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import { HubConnection } from "../src/HubConnection";
55
import { IConnection } from "../src/IConnection";
6-
import { IHubProtocol } from "../src/IHubProtocol";
6+
import { IHubProtocol, MessageType } from "../src/IHubProtocol";
77
import { ILogger } from "../src/ILogger";
88
import { JsonHubProtocol } from "../src/JsonHubProtocol";
99
import { NullLogger } from "../src/Loggers";
@@ -34,6 +34,7 @@ describe("Message size", () => {
3434

3535
// Verify the message is sent
3636
expect(connection.sentData.length).toBe(1);
37+
expect(connection.parsedSentData[0].type).toEqual(MessageType.Invocation);
3738
expect((connection.sentData[0] as string).length).toEqual(44);
3839
} finally {
3940
// Close the connection
@@ -55,6 +56,7 @@ describe("Message size", () => {
5556

5657
// Verify the message is sent
5758
expect(connection.sentData.length).toBe(1);
59+
expect(connection.parsedSentData[0].type).toEqual(MessageType.Invocation);
5860
expect((connection.sentData[0] as string).length).toEqual(63);
5961
} finally {
6062
// Close the connection
@@ -73,6 +75,7 @@ describe("Message size", () => {
7375

7476
// Verify the message is sent
7577
expect(connection.sentData.length).toBe(1);
78+
expect(connection.parsedSentData[0].type).toEqual(MessageType.StreamInvocation);
7679
expect((connection.sentData[0] as string).length).toEqual(63);
7780
} finally {
7881
// Close the connection
@@ -94,6 +97,7 @@ describe("Message size", () => {
9497

9598
// Verify the message is sent
9699
expect(connection.sentData.length).toBe(1);
100+
expect(connection.parsedSentData[0].type).toEqual(MessageType.Invocation);
97101
expect((connection.sentData[0] as string).length).toEqual(81);
98102
} finally {
99103
// Close the connection
@@ -112,6 +116,7 @@ describe("Message size", () => {
112116

113117
// Verify the message is sent
114118
expect(connection.sentData.length).toBe(1);
119+
expect(connection.parsedSentData[0].type).toEqual(MessageType.StreamInvocation);
115120
expect((connection.sentData[0] as string).length).toEqual(81);
116121
} finally {
117122
// Close the connection
@@ -134,6 +139,7 @@ describe("Message size", () => {
134139

135140
// Verify the message is sent
136141
expect(connection.sentData.length).toBe(2);
142+
expect(connection.parsedSentData[1].type).toEqual(MessageType.Completion);
137143
expect((connection.sentData[1] as string).length).toEqual(29);
138144
} finally {
139145
// Close the connection
@@ -158,6 +164,7 @@ describe("Message size", () => {
158164

159165
// Verify the message is sent
160166
expect(connection.sentData.length).toBe(2);
167+
expect(connection.parsedSentData[1].type).toEqual(MessageType.CancelInvocation);
161168
expect((connection.sentData[1] as string).length).toEqual(29);
162169
} finally {
163170
// Close the connection

src/SignalR/clients/ts/signalr/tests/TestConnection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export class TestConnection implements IConnection {
1313
public onclose: ((error?: Error) => void) | null;
1414

1515
public sentData: any[];
16+
public parsedSentData: any[];
1617
public lastInvocationId: string | null;
1718

1819
private autoHandshake: boolean | null;
@@ -21,6 +22,7 @@ export class TestConnection implements IConnection {
2122
this.onreceive = null;
2223
this.onclose = null;
2324
this.sentData = [];
25+
this.parsedSentData = [];
2426
this.lastInvocationId = null;
2527
this.autoHandshake = autoHandshake;
2628
this.baseUrl = "http://example.com";
@@ -43,8 +45,10 @@ export class TestConnection implements IConnection {
4345
}
4446
if (this.sentData) {
4547
this.sentData.push(invocation);
48+
this.parsedSentData.push(parsedInvocation);
4649
} else {
4750
this.sentData = [invocation];
51+
this.parsedSentData = [parsedInvocation];
4852
}
4953
return Promise.resolve();
5054
}

0 commit comments

Comments
 (0)