@@ -341,6 +341,7 @@ describe('ACSClient', () => {
341
341
await client . initialize ( config ) ;
342
342
343
343
const chatThreadClient : any = { } ;
344
+ const sendMessageResponse = { id : '0' } ;
344
345
chatThreadClient . listParticipants = jest . fn ( ( ) => ( {
345
346
next : jest . fn ( ( ) => ( {
346
347
value : 'value' ,
@@ -353,7 +354,7 @@ describe('ACSClient', () => {
353
354
done : jest . fn ( )
354
355
} ) ) ,
355
356
} ) ) ;
356
- chatThreadClient . sendMessage = jest . fn ( ) ;
357
+ chatThreadClient . sendMessage = jest . fn ( ( ) => sendMessageResponse ) ;
357
358
358
359
client . chatClient = { } ;
359
360
client . chatClient . getChatThreadClient = jest . fn ( ( ) => chatThreadClient ) ;
@@ -365,11 +366,20 @@ describe('ACSClient', () => {
365
366
pollingInterval : 1000 ,
366
367
} ) ;
367
368
368
- await conversation . sendMessage ( {
369
- content : 'message' ,
369
+ const content = 'message' ;
370
+ const chatMessage = await conversation . sendMessage ( {
371
+ content
370
372
} ) ;
371
373
372
374
expect ( chatThreadClient . sendMessage ) . toHaveBeenCalledTimes ( 1 ) ;
375
+ expect ( chatMessage ) . toBeDefined ( ) ;
376
+ expect ( chatMessage . id ) . toBe ( sendMessageResponse . id ) ;
377
+ expect ( chatMessage . content ) . toBe ( content ) ;
378
+ expect ( chatMessage . tags . includes ( 'FromCustomer' ) ) . toBe ( true ) ;
379
+ expect ( chatMessage . tags . includes ( 'ChannelId-lcw' ) ) . toBe ( true ) ;
380
+ expect ( chatMessage . properties . tags . includes ( 'FromCustomer' ) ) . toBe ( true ) ;
381
+ expect ( chatMessage . properties . tags . includes ( 'ChannelId-lcw' ) ) . toBe ( true ) ;
382
+ expect ( chatMessage . timestamp ) . toBeDefined ( ) ;
373
383
} ) ;
374
384
375
385
it ( 'ACSClient.sendMessage() failure should throw an error' , async ( ) => {
0 commit comments