File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -308,6 +308,37 @@ describe('Tests ReactNativeClient', () => {
308
308
} ) ;
309
309
} ) ;
310
310
311
+ describe ( 'normalizes events' , ( ) => {
312
+ test ( 'handles circular input' , async ( ) => {
313
+ const mockedSend = jest . fn < PromiseLike < void > , [ Envelope ] > ( ) ;
314
+ const mockedTransport = ( ) : Transport => ( {
315
+ send : mockedSend ,
316
+ flush : jest . fn ( ) . mockResolvedValue ( true ) ,
317
+ } ) ;
318
+ const client = new ReactNativeClient ( < ReactNativeClientOptions > {
319
+ ...DEFAULT_OPTIONS ,
320
+ dsn : EXAMPLE_DSN ,
321
+ transport : mockedTransport ,
322
+ } ) ;
323
+ const circularEvent = {
324
+ extra : {
325
+ circular : { } ,
326
+ } ,
327
+ } ;
328
+ circularEvent . extra . circular = circularEvent ;
329
+
330
+ client . captureEvent ( circularEvent ) ;
331
+
332
+ expect ( mockedSend ) . toBeCalled ( ) ;
333
+ const actualEvent : Event | undefined = < Event > mockedSend . mock . calls [ 0 ] [ firstArg ] [ envelopeItems ] [ 0 ] [ envelopeItemPayload ] ;
334
+ expect ( actualEvent ?. extra ) . toEqual ( {
335
+ circular : {
336
+ extra : '[Circular ~]' ,
337
+ } ,
338
+ } ) ;
339
+ } ) ;
340
+ } ) ;
341
+
311
342
describe ( 'clientReports' , ( ) => {
312
343
test ( 'does not send client reports if disabled' , ( ) => {
313
344
const mockTransportSend = jest . fn ( ( _envelope : Envelope ) => Promise . resolve ( ) ) ;
You can’t perform that action at this time.
0 commit comments