@webex/contact-center 3.12.0-next.13 → 3.12.0-next.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -691,6 +691,27 @@ describe('Task', () => {
691
691
  );
692
692
  });
693
693
 
694
+ it('should hold using mediaResourceId from interaction.media after recording event wipes top-level mediaResourceId', async () => {
695
+ // Set a DIFFERENT top-level mediaResourceId so we can distinguish the two sources
696
+ const staleTopLevelId = 'stale-top-level-media-resource-id';
697
+ const correctMediaId = task.data.interaction.media[task.data.interaction.mainInteractionId].mediaResourceId;
698
+ task.data.mediaResourceId = staleTopLevelId;
699
+
700
+ // Simulate recording event wiping top-level mediaResourceId (as reconcileData does)
701
+ delete task.data.mediaResourceId;
702
+
703
+ const expectedResponse: TaskResponse = {data: {interactionId: taskId}} as AgentContact;
704
+ contactMock.hold.mockResolvedValue(expectedResponse);
705
+
706
+ await task.hold();
707
+
708
+ // hold() should read from interaction.media, not the (now deleted) top-level field
709
+ expect(contactMock.hold).toHaveBeenCalledWith({
710
+ interactionId: taskId,
711
+ data: {mediaResourceId: correctMediaId},
712
+ });
713
+ });
714
+
694
715
  it('should handle errors in hold method', async () => {
695
716
  const error = {details: (global as any).makeFailure('Hold Failed')};
696
717
  contactMock.hold.mockImplementation(() => {