@@ -30,6 +30,7 @@ const TRANSACTION_ENVELOPE = createEnvelope<EventEnvelope>(
3030 { event_id : 'aa3ff046696b4bc6b609ce6d28fde9e2' , sent_at : '123' } ,
3131 [ [ { type : 'transaction' } , TRANSACTION_EVENT ] as EventItem ] ,
3232) ;
33+ const REPLAY_EVENT = { type : 'replay_event' , event_id : 'aa3ff046696b4bc6b609ce6d28fde9e2' } ;
3334
3435const DEFAULT_DISCARDED_EVENTS : ClientReport [ 'discarded_events' ] = [
3536 {
@@ -320,4 +321,34 @@ describe('makeMultiplexedTransport() with default matcher', () => {
320321 const transport = makeTransport ( { url : DSN1_URL , ...transportOptions } ) ;
321322 await transport . send ( envelope ) ;
322323 } ) ;
324+
325+ it ( 'sends replay events to targets provided in event.extra[MULTIPLEXED_TRANSPORT_EXTRA_KEY]' , async ( ) => {
326+ expect . assertions ( 2 ) ;
327+
328+ const makeTransport = makeMultiplexedTransport (
329+ createTestTransport (
330+ url => {
331+ expect ( url ) . toBe ( DSN1_URL ) ;
332+ } ,
333+ url => {
334+ expect ( url ) . toBe ( DSN2_URL ) ;
335+ } ,
336+ ) ,
337+ ) ;
338+
339+ const envelope = createEnvelope < EventEnvelope > ( { event_id : 'aa3ff046696b4bc6b609ce6d28fde9e2' , sent_at : '123' } , [
340+ [
341+ { type : 'replay_event' } ,
342+ {
343+ ...REPLAY_EVENT ,
344+ extra : {
345+ [ MULTIPLEXED_TRANSPORT_EXTRA_KEY ] : [ DSN1 , DSN2 ] ,
346+ } ,
347+ } ,
348+ ] as EventItem ,
349+ ] ) ;
350+
351+ const transport = makeTransport ( { url : DSN1_URL , ...transportOptions } ) ;
352+ await transport . send ( envelope ) ;
353+ } ) ;
323354} ) ;
0 commit comments