@@ -218,6 +218,40 @@ describe("MessagePackHubProtocol", () => {
218
218
expect ( new Uint8Array ( buffer ) ) . toEqual ( payload ) ;
219
219
} ) ;
220
220
221
+ it ( "can write completion message with false result" , ( ) => {
222
+ const payload = new Uint8Array ( [
223
+ 0x09 , // length prefix
224
+ 0x95 , // message array length = 5 (fixarray)
225
+ 0x03 , // type = 3 = Completion
226
+ 0x80 , // headers
227
+ 0xa3 , // invocationID = string length 3
228
+ 0x61 , // a
229
+ 0x62 , // b
230
+ 0x63 , // c
231
+ 0x03 , // result type, 3 - non-void result
232
+ 0xc2 , // false
233
+ ] ) ;
234
+ const buffer = new MessagePackHubProtocol ( ) . writeMessage ( { type : MessageType . Completion , invocationId : "abc" , result : false } ) ;
235
+ expect ( new Uint8Array ( buffer ) ) . toEqual ( payload ) ;
236
+ } ) ;
237
+
238
+ it ( "can write completion message with null result" , ( ) => {
239
+ const payload = new Uint8Array ( [
240
+ 0x09 , // length prefix
241
+ 0x95 , // message array length = 5 (fixarray)
242
+ 0x03 , // type = 3 = Completion
243
+ 0x80 , // headers
244
+ 0xa3 , // invocationID = string length 3
245
+ 0x61 , // a
246
+ 0x62 , // b
247
+ 0x63 , // c
248
+ 0x03 , // result type, 3 - non-void result
249
+ 0xc0 , // null
250
+ ] ) ;
251
+ const buffer = new MessagePackHubProtocol ( ) . writeMessage ( { type : MessageType . Completion , invocationId : "abc" , result : null } ) ;
252
+ expect ( new Uint8Array ( buffer ) ) . toEqual ( payload ) ;
253
+ } ) ;
254
+
221
255
it ( "will preserve double precision" , ( ) => {
222
256
const invocation = {
223
257
arguments : [ Number ( 0.005 ) ] ,
0 commit comments