@@ -42,7 +42,14 @@ const fakeCallback: Callback = (err, result) => {
4242
4343function expectScopeSettings ( ) {
4444 // @ts -expect-error see "Why @ts-expect-error" note
45- expect ( SentryNode . fakeScope . setTransactionName ) . toBeCalledWith ( 'functionName' ) ;
45+ expect ( SentryNode . fakeScope . addEventProcessor ) . toBeCalledTimes ( 1 ) ;
46+ // Test than an event processor to add `transaction` is registered for the scope
47+ // @ts -expect-error see "Why @ts-expect-error" note
48+ const eventProcessor = SentryNode . fakeScope . addEventProcessor . mock . calls [ 0 ] [ 0 ] ;
49+ const event : Event = { } ;
50+ eventProcessor ( event ) ;
51+ expect ( event ) . toEqual ( { transaction : 'functionName' } ) ;
52+
4653 // @ts -expect-error see "Why @ts-expect-error" note
4754 expect ( SentryNode . fakeScope . setTag ) . toBeCalledWith ( 'server_name' , expect . anything ( ) ) ;
4855 // @ts -expect-error see "Why @ts-expect-error" note
@@ -186,7 +193,7 @@ describe('AWSLambda', () => {
186193 await wrappedHandler ( fakeEvent , fakeContext , fakeCallback ) ;
187194
188195 // @ts -expect-error see "Why @ts-expect-error" note
189- expect ( SentryNode . fakeScope . setTransactionName ) . toBeCalledTimes ( 0 ) ;
196+ expect ( SentryNode . fakeScope . addEventProcessor ) . toBeCalledTimes ( 0 ) ;
190197 // @ts -expect-error see "Why @ts-expect-error" note
191198 expect ( SentryNode . fakeScope . setTag ) . toBeCalledTimes ( 0 ) ;
192199 expect ( SentryNode . startSpanManual ) . toBeCalledTimes ( 0 ) ;
@@ -195,7 +202,7 @@ describe('AWSLambda', () => {
195202
196203 describe ( 'wrapHandler() on sync handler' , ( ) => {
197204 test ( 'successful execution' , async ( ) => {
198- expect . assertions ( 9 ) ;
205+ expect . assertions ( 10 ) ;
199206
200207 const handler : Handler = ( _event , _context , callback ) => {
201208 callback ( null , 42 ) ;
@@ -222,7 +229,7 @@ describe('AWSLambda', () => {
222229 } ) ;
223230
224231 test ( 'unsuccessful execution' , async ( ) => {
225- expect . assertions ( 9 ) ;
232+ expect . assertions ( 10 ) ;
226233
227234 const error = new Error ( 'sorry' ) ;
228235 const handler : Handler = ( _event , _context , callback ) => {
@@ -301,7 +308,7 @@ describe('AWSLambda', () => {
301308 } ) ;
302309
303310 test ( 'capture error' , async ( ) => {
304- expect . assertions ( 9 ) ;
311+ expect . assertions ( 10 ) ;
305312
306313 const error = new Error ( 'wat' ) ;
307314 const handler : Handler = ( _event , _context , _callback ) => {
@@ -338,7 +345,7 @@ describe('AWSLambda', () => {
338345
339346 describe ( 'wrapHandler() on async handler' , ( ) => {
340347 test ( 'successful execution' , async ( ) => {
341- expect . assertions ( 9 ) ;
348+ expect . assertions ( 10 ) ;
342349
343350 const handler : Handler = async ( _event , _context ) => {
344351 return 42 ;
@@ -376,7 +383,7 @@ describe('AWSLambda', () => {
376383 } ) ;
377384
378385 test ( 'capture error' , async ( ) => {
379- expect . assertions ( 9 ) ;
386+ expect . assertions ( 10 ) ;
380387
381388 const error = new Error ( 'wat' ) ;
382389 const handler : Handler = async ( _event , _context ) => {
@@ -424,7 +431,7 @@ describe('AWSLambda', () => {
424431
425432 describe ( 'wrapHandler() on async handler with a callback method (aka incorrect usage)' , ( ) => {
426433 test ( 'successful execution' , async ( ) => {
427- expect . assertions ( 9 ) ;
434+ expect . assertions ( 10 ) ;
428435
429436 const handler : Handler = async ( _event , _context , _callback ) => {
430437 return 42 ;
@@ -462,7 +469,7 @@ describe('AWSLambda', () => {
462469 } ) ;
463470
464471 test ( 'capture error' , async ( ) => {
465- expect . assertions ( 9 ) ;
472+ expect . assertions ( 10 ) ;
466473
467474 const error = new Error ( 'wat' ) ;
468475 const handler : Handler = async ( _event , _context , _callback ) => {
0 commit comments