@@ -5,25 +5,26 @@ import {
55 DailyParticipant ,
66} from '@daily-co/daily-js' ;
77import faker from 'faker' ;
8+ import { mockEvent } from './mocks' ;
89
910export const emitStartedCamera = ( callObject : DailyCall ) => {
1011 // @ts -ignore
11- callObject . emit ( 'started-camera' , {
12+ callObject . emit ( 'started-camera' , mockEvent ( {
1213 action : 'started-camera' ,
13- } ) ;
14+ } ) ) ;
1415} ;
1516
1617export const emitActiveSpeakerChange = (
1718 callObject : DailyCall ,
1819 peerId : string
1920) => {
2021 // @ts -ignore
21- callObject . emit ( 'active-speaker-change' , {
22+ callObject . emit ( 'active-speaker-change' , mockEvent ( {
2223 action : 'active-speaker-change' ,
2324 activeSpeaker : {
2425 peerId,
2526 } ,
26- } ) ;
27+ } ) ) ;
2728} ;
2829
2930export const emitTrackStarted = (
@@ -32,69 +33,69 @@ export const emitTrackStarted = (
3233 track : Partial < MediaStreamTrack >
3334) => {
3435 // @ts -ignore
35- callObject . emit ( 'track-started' , {
36+ callObject . emit ( 'track-started' , mockEvent ( {
3637 action : 'track-started' ,
3738 participant,
3839 track,
39- } ) ;
40+ } ) ) ;
4041} ;
4142
4243export const emitParticipantLeft = (
4344 callObject : DailyCall ,
4445 participant : Partial < DailyParticipant >
4546) => {
4647 // @ts -ignore
47- callObject . emit ( 'participant-left' , {
48+ callObject . emit ( 'participant-left' , mockEvent ( {
4849 action : 'participant-left' ,
4950 participant,
50- } ) ;
51+ } ) ) ;
5152} ;
5253
5354export const emitParticipantUpdated = (
5455 callObject : DailyCall ,
5556 participant : Partial < DailyParticipant >
5657) => {
5758 // @ts -ignore
58- callObject . emit ( 'participant-updated' , {
59+ callObject . emit ( 'participant-updated' , mockEvent ( {
5960 action : 'participant-updated' ,
6061 participant,
61- } ) ;
62+ } ) ) ;
6263} ;
6364
6465export const emitParticipantJoined = (
6566 callObject : DailyCall ,
6667 participant : Partial < DailyParticipant >
6768) => {
6869 // @ts -ignore
69- callObject . emit ( 'participant-joined' , {
70+ callObject . emit ( 'participant-joined' , mockEvent ( {
7071 action : 'participant-joined' ,
7172 participant,
72- } ) ;
73+ } ) ) ;
7374} ;
7475
7576export const emitJoinedMeeting = (
7677 callObject : DailyCall ,
7778 participants : Record < string , Partial < DailyParticipant > >
7879) => {
7980 // @ts -ignore
80- callObject . emit ( 'joined-meeting' , {
81+ callObject . emit ( 'joined-meeting' , mockEvent ( {
8182 action : 'joined-meeting' ,
8283 participants,
83- } ) ;
84+ } ) ) ;
8485} ;
8586
8687export const emitLeftMeeting = ( callObject : DailyCall ) => {
8788 // @ts -ignore
88- callObject . emit ( 'left-meeting' , {
89+ callObject . emit ( 'left-meeting' , mockEvent ( {
8990 action : 'left-meeting' ,
90- } ) ;
91+ } ) ) ;
9192} ;
9293
9394export const emitTranscriptionStarted = (
9495 callObject : DailyCall ,
9596 data : Partial < DailyEventObjectTranscriptionStarted > = { }
9697) => {
97- const payload : DailyEventObjectTranscriptionStarted = {
98+ const payload : DailyEventObjectTranscriptionStarted = mockEvent ( {
9899 action : 'transcription-started' ,
99100 language : 'en' ,
100101 model : 'general' ,
@@ -104,7 +105,7 @@ export const emitTranscriptionStarted = (
104105 redact : true ,
105106 includeRawResponse : false ,
106107 ...data ,
107- } ;
108+ } ) ;
108109 // @ts -ignore
109110 callObject . emit ( 'transcription-started' , payload ) ;
110111} ;
@@ -113,10 +114,10 @@ export const emitTranscriptionStopped = (
113114 callObject : DailyCall ,
114115 updatedBy : string
115116) => {
116- const payload : DailyEventObjectTranscriptionStopped = {
117+ const payload : DailyEventObjectTranscriptionStopped = mockEvent ( {
117118 action : 'transcription-stopped' ,
118119 updatedBy : updatedBy ?? faker . datatype . uuid ( ) ,
119- } ;
120+ } ) ;
120121 // @ts -ignore
121122 callObject . emit ( 'transcription-stopped' , payload ) ;
122123} ;
0 commit comments