@@ -45,45 +45,39 @@ describe('Nuxt Server SDK', () => {
45
45
expect ( init ( { } ) ) . not . toBeUndefined ( ) ;
46
46
} ) ;
47
47
48
- it ( 'filters out low quality transactions' , async ( ) => {
48
+ describe ( ' low quality transactions filter (%s)' , ( ) => {
49
49
const beforeSendEvent = vi . fn ( event => event ) ;
50
50
const client = init ( {
51
51
dsn :
'https://[email protected] /1337' ,
52
52
} ) as NodeClient ;
53
53
client . on ( 'beforeSendEvent' , beforeSendEvent ) ;
54
54
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
+ } ) ;
62
68
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
+ } ,
87
81
) ;
88
82
} ) ;
89
83
0 commit comments