3
3
4
4
import { HubConnection } from "../src/HubConnection" ;
5
5
import { IConnection } from "../src/IConnection" ;
6
- import { IHubProtocol } from "../src/IHubProtocol" ;
6
+ import { IHubProtocol , MessageType } from "../src/IHubProtocol" ;
7
7
import { ILogger } from "../src/ILogger" ;
8
8
import { JsonHubProtocol } from "../src/JsonHubProtocol" ;
9
9
import { NullLogger } from "../src/Loggers" ;
@@ -34,6 +34,7 @@ describe("Message size", () => {
34
34
35
35
// Verify the message is sent
36
36
expect ( connection . sentData . length ) . toBe ( 1 ) ;
37
+ expect ( connection . parsedSentData [ 0 ] . type ) . toEqual ( MessageType . Invocation ) ;
37
38
expect ( ( connection . sentData [ 0 ] as string ) . length ) . toEqual ( 44 ) ;
38
39
} finally {
39
40
// Close the connection
@@ -55,6 +56,7 @@ describe("Message size", () => {
55
56
56
57
// Verify the message is sent
57
58
expect ( connection . sentData . length ) . toBe ( 1 ) ;
59
+ expect ( connection . parsedSentData [ 0 ] . type ) . toEqual ( MessageType . Invocation ) ;
58
60
expect ( ( connection . sentData [ 0 ] as string ) . length ) . toEqual ( 63 ) ;
59
61
} finally {
60
62
// Close the connection
@@ -73,6 +75,7 @@ describe("Message size", () => {
73
75
74
76
// Verify the message is sent
75
77
expect ( connection . sentData . length ) . toBe ( 1 ) ;
78
+ expect ( connection . parsedSentData [ 0 ] . type ) . toEqual ( MessageType . StreamInvocation ) ;
76
79
expect ( ( connection . sentData [ 0 ] as string ) . length ) . toEqual ( 63 ) ;
77
80
} finally {
78
81
// Close the connection
@@ -94,6 +97,7 @@ describe("Message size", () => {
94
97
95
98
// Verify the message is sent
96
99
expect ( connection . sentData . length ) . toBe ( 1 ) ;
100
+ expect ( connection . parsedSentData [ 0 ] . type ) . toEqual ( MessageType . Invocation ) ;
97
101
expect ( ( connection . sentData [ 0 ] as string ) . length ) . toEqual ( 81 ) ;
98
102
} finally {
99
103
// Close the connection
@@ -112,6 +116,7 @@ describe("Message size", () => {
112
116
113
117
// Verify the message is sent
114
118
expect ( connection . sentData . length ) . toBe ( 1 ) ;
119
+ expect ( connection . parsedSentData [ 0 ] . type ) . toEqual ( MessageType . StreamInvocation ) ;
115
120
expect ( ( connection . sentData [ 0 ] as string ) . length ) . toEqual ( 81 ) ;
116
121
} finally {
117
122
// Close the connection
@@ -134,6 +139,7 @@ describe("Message size", () => {
134
139
135
140
// Verify the message is sent
136
141
expect ( connection . sentData . length ) . toBe ( 2 ) ;
142
+ expect ( connection . parsedSentData [ 1 ] . type ) . toEqual ( MessageType . Completion ) ;
137
143
expect ( ( connection . sentData [ 1 ] as string ) . length ) . toEqual ( 29 ) ;
138
144
} finally {
139
145
// Close the connection
@@ -158,6 +164,7 @@ describe("Message size", () => {
158
164
159
165
// Verify the message is sent
160
166
expect ( connection . sentData . length ) . toBe ( 2 ) ;
167
+ expect ( connection . parsedSentData [ 1 ] . type ) . toEqual ( MessageType . CancelInvocation ) ;
161
168
expect ( ( connection . sentData [ 1 ] as string ) . length ) . toEqual ( 29 ) ;
162
169
} finally {
163
170
// Close the connection
0 commit comments