@@ -45,45 +45,39 @@ describe('Nuxt Server SDK', () => {
4545 expect ( init ( { } ) ) . not . toBeUndefined ( ) ;
4646 } ) ;
4747
48- it ( 'filters out low quality transactions' , async ( ) => {
48+ describe ( ' low quality transactions filter (%s)' , ( ) => {
4949 const beforeSendEvent = vi . fn ( event => event ) ;
5050 const client = init ( {
5151 dsn :
'https://[email protected] /1337' , 5252 } ) as NodeClient ;
5353 client . on ( 'beforeSendEvent' , beforeSendEvent ) ;
5454
55- client . captureEvent ( { type : 'transaction' , transaction : 'GET /' } ) ;
56- client . captureEvent ( { type : 'transaction' , transaction : 'GET /_nuxt/some_asset.js' } ) ;
57- // Although this has the name of the build asset directory (_nuxt), it should not be filtered out as it would not match the regex
58- client . captureEvent ( { type : 'transaction' , transaction : 'GET _nuxt/some_asset.js' } ) ;
59- client . captureEvent ( { type : 'transaction' , transaction : 'POST /_server' } ) ;
60-
61- await client ! . flush ( ) ;
55+ it . each ( [
56+ [
57+ 'GET /_nuxt/some_asset.js' ,
58+ 'GET _nuxt/some_asset.js' ,
59+ 'GET /icons/favicon.ico' ,
60+ 'GET /assets/logo.png' ,
61+ 'GET /icons/zones/forest.svg' ,
62+ ] ,
63+ ] ) ( 'filters out low quality transactions' , async transaction => {
64+ client . captureEvent ( { type : 'transaction' , transaction } ) ;
65+ await client ! . flush ( ) ;
66+ expect ( beforeSendEvent ) . not . toHaveBeenCalled ( ) ;
67+ } ) ;
6268
63- expect ( beforeSendEvent ) . toHaveBeenCalledTimes ( 3 ) ;
64- expect ( beforeSendEvent ) . toHaveBeenCalledWith (
65- expect . objectContaining ( {
66- transaction : 'GET /' ,
67- } ) ,
68- expect . any ( Object ) ,
69- ) ;
70- expect ( beforeSendEvent ) . toHaveBeenCalledWith (
71- expect . objectContaining ( {
72- transaction : 'GET _nuxt/some_asset.js' ,
73- } ) ,
74- expect . any ( Object ) ,
75- ) ;
76- expect ( beforeSendEvent ) . not . toHaveBeenCalledWith (
77- expect . objectContaining ( {
78- transaction : 'GET /_nuxt/some_asset.js' ,
79- } ) ,
80- expect . any ( Object ) ,
81- ) ;
82- expect ( beforeSendEvent ) . toHaveBeenCalledWith (
83- expect . objectContaining ( {
84- transaction : 'POST /_server' ,
85- } ) ,
86- expect . any ( Object ) ,
69+ it . each ( [ 'GET /' , 'POST /_server' ] ) (
70+ 'does not filter out high quality or route transactions (%s)' ,
71+ async transaction => {
72+ client . captureEvent ( { type : 'transaction' , transaction } ) ;
73+ await client ! . flush ( ) ;
74+ expect ( beforeSendEvent ) . toHaveBeenCalledWith (
75+ expect . objectContaining ( {
76+ transaction,
77+ } ) ,
78+ expect . any ( Object ) ,
79+ ) ;
80+ } ,
8781 ) ;
8882 } ) ;
8983
0 commit comments