File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1565,6 +1565,34 @@ describe('RPCClient', function(){
1565
1565
1566
1566
} ) ;
1567
1567
1568
+ it ( 'should emit badMessage upon a response to a noReply call' , async ( ) => {
1569
+
1570
+ const echoPayload = { abc : 123 } ;
1571
+ const { endpoint, close} = await createServer ( ) ;
1572
+ const cli = new RPCClient ( {
1573
+ endpoint,
1574
+ identity : 'X' ,
1575
+ } ) ;
1576
+
1577
+ try {
1578
+ await cli . connect ( ) ;
1579
+
1580
+ const res = await cli . call ( 'Echo' , echoPayload , { noReply : true } ) ;
1581
+ const [ bad ] = await once ( cli , 'badMessage' ) ;
1582
+
1583
+ const [ mType , mId , mVal ] = JSON . parse ( bad . buffer . toString ( 'utf8' ) ) ;
1584
+
1585
+ assert . equal ( mType , 3 ) ;
1586
+ assert . deepEqual ( mVal , echoPayload ) ;
1587
+ assert . equal ( res , undefined ) ;
1588
+
1589
+ } finally {
1590
+ await cli . close ( ) ;
1591
+ close ( ) ;
1592
+ }
1593
+
1594
+ } ) ;
1595
+
1568
1596
} ) ;
1569
1597
1570
1598
You can’t perform that action at this time.
0 commit comments