@@ -12,19 +12,20 @@ import DailyIframe, {
1212import { act , renderHook } from '@testing-library/react-hooks' ;
1313import faker from 'faker' ;
1414import React from 'react' ;
15- import { RecoilRoot } from 'recoil' ;
1615
1716import { DailyProvider } from '../../src/DailyProvider' ;
1817import { useRecording } from '../../src/hooks/useRecording' ;
1918
19+ const localId = faker . datatype . uuid ( ) ;
20+
21+ jest . mock ( '../../src/hooks/useLocalParticipant' , ( ) => ( {
22+ useLocalParticipant : ( ) => ( { session_id : localId } ) ,
23+ } ) ) ;
24+
2025const createWrapper =
2126 ( callObject : DailyCall = DailyIframe . createCallObject ( ) ) : React . FC =>
2227 ( { children } ) =>
23- (
24- < DailyProvider callObject = { callObject } >
25- < RecoilRoot > { children } </ RecoilRoot >
26- </ DailyProvider >
27- ) ;
28+ < DailyProvider callObject = { callObject } > { children } </ DailyProvider > ;
2829
2930describe ( 'useRecording' , ( ) => {
3031 it ( 'returns default state and functions' , async ( ) => {
@@ -185,16 +186,12 @@ describe('useRecording', () => {
185186 } ) ;
186187 it ( 'single-participant recording for other participant sets isLocalParticipantRecorded to false' , async ( ) => {
187188 const daily = DailyIframe . createCallObject ( ) ;
188- const localId = faker . datatype . uuid ( ) ;
189- const otherId = faker . datatype . uuid ( ) ;
189+ const otherId = 'other' ;
190190 ( daily . participants as jest . Mock ) . mockImplementation ( ( ) => ( {
191191 local : {
192192 session_id : localId ,
193193 } ,
194194 } ) ) ;
195- jest . mock ( '../../src/hooks/useLocalParticipant' , ( ) => ( {
196- useLocalParticipant : ( ) => ( { session_id : localId } ) ,
197- } ) ) ;
198195 const { result, waitFor } = renderHook ( ( ) => useRecording ( ) , {
199196 wrapper : createWrapper ( daily ) ,
200197 } ) ;
@@ -207,7 +204,7 @@ describe('useRecording', () => {
207204 } ,
208205 local : false ,
209206 recordingId : faker . datatype . uuid ( ) ,
210- startedBy : faker . datatype . uuid ( ) ,
207+ startedBy : localId ,
211208 type : 'cloud' ,
212209 } ;
213210 act ( ( ) => {
0 commit comments