@@ -332,18 +332,16 @@ describe('validateAndBuildRumConfiguration', () => {
332332 it ( 'is disabled by default' , ( ) => {
333333 const configuration = validateAndBuildRumConfiguration ( DEFAULT_INIT_CONFIGURATION ) !
334334
335- expect ( configuration . enableSessionReplayCanvasRecording ) . toBeFalse ( )
336- expect ( configuration . sessionReplayMaxCanvasFps ) . toBe ( 0 )
335+ expect ( configuration . enableSessionReplayCanvasRecording ) . toBeUndefined ( )
337336 } )
338337
339338 it ( 'stays disabled when requested without the experimental feature' , ( ) => {
340339 const configuration = validateAndBuildRumConfiguration ( {
341340 ...DEFAULT_INIT_CONFIGURATION ,
342- enableSessionReplayCanvasRecording : true ,
341+ enableSessionReplayCanvasRecording : { } ,
343342 } ) !
344343
345- expect ( configuration . enableSessionReplayCanvasRecording ) . toBeFalse ( )
346- expect ( configuration . sessionReplayMaxCanvasFps ) . toBe ( 0 )
344+ expect ( configuration . enableSessionReplayCanvasRecording ) . toBeUndefined ( )
347345 } )
348346
349347 describe ( 'when the experimental feature is enabled' , ( ) => {
@@ -354,21 +352,29 @@ describe('validateAndBuildRumConfiguration', () => {
354352 it ( 'uses one frame per second by default when enabled' , ( ) => {
355353 const configuration = validateAndBuildRumConfiguration ( {
356354 ...DEFAULT_INIT_CONFIGURATION ,
357- enableSessionReplayCanvasRecording : true ,
355+ enableSessionReplayCanvasRecording : { } ,
358356 } ) !
359357
360- expect ( configuration . enableSessionReplayCanvasRecording ) . toBeTrue ( )
361- expect ( configuration . sessionReplayMaxCanvasFps ) . toBe ( 1 )
358+ expect ( configuration . enableSessionReplayCanvasRecording ) . toEqual ( { maxFramesPerSecond : 1 } )
362359 } )
363360
364361 it ( 'uses the configured frame rate' , ( ) => {
365362 const configuration = validateAndBuildRumConfiguration ( {
366363 ...DEFAULT_INIT_CONFIGURATION ,
367- enableSessionReplayCanvasRecording : true ,
368- sessionReplayMaxCanvasFps : 2.5 ,
364+ enableSessionReplayCanvasRecording : { maxFramesPerSecond : 2.5 } ,
369365 } ) !
370366
371- expect ( configuration . sessionReplayMaxCanvasFps ) . toBe ( 2.5 )
367+ expect ( configuration . enableSessionReplayCanvasRecording ) . toEqual ( { maxFramesPerSecond : 2.5 } )
368+ } )
369+
370+ it ( 'rejects invalid canvas recording options' , ( ) => {
371+ expect (
372+ validateAndBuildRumConfiguration ( {
373+ ...DEFAULT_INIT_CONFIGURATION ,
374+ enableSessionReplayCanvasRecording : true as any ,
375+ } )
376+ ) . toBeUndefined ( )
377+ expect ( displayErrorSpy ) . toHaveBeenCalledOnceWith ( '"enableSessionReplayCanvasRecording" is not a valid object' )
372378 } )
373379 } )
374380 } )
@@ -923,8 +929,7 @@ describe('serializeRumConfiguration', () => {
923929 trackResourceHeaders : true ,
924930 betaEnableViewUpdates : true ,
925931 betaTrackWebSockets : false ,
926- enableSessionReplayCanvasRecording : true ,
927- sessionReplayMaxCanvasFps : 2.5 ,
932+ enableSessionReplayCanvasRecording : { maxFramesPerSecond : 2.5 } ,
928933 }
929934
930935 type MapRumInitConfigurationKey < Key extends string > = Key extends keyof InitConfiguration
@@ -940,12 +945,7 @@ describe('serializeRumConfiguration', () => {
940945 ? 'track_long_task' // We forgot the s, keeping this for backward compatibility
941946 : // The following options are not reported as telemetry. Please avoid adding more of them.
942947 // `remoteConfiguration` is covered by the legacy `remote_configuration_id` field.
943- Key extends
944- | 'applicationId'
945- | 'subdomain'
946- | 'remoteConfiguration'
947- | 'enableSessionReplayCanvasRecording'
948- | 'sessionReplayMaxCanvasFps'
948+ Key extends 'applicationId' | 'subdomain' | 'remoteConfiguration' | 'enableSessionReplayCanvasRecording'
949949 ? never
950950 : CamelToSnakeCase < Key >
951951 // By specifying the type here, we can ensure that serializeConfiguration is returning an
0 commit comments