@@ -178,44 +178,6 @@ describe('AWSLambda', () => {
178178 expect ( Sentry . captureException ) . toHaveBeenNthCalledWith ( 2 , error2 ) ;
179179 expect ( Sentry . captureException ) . toBeCalledTimes ( 2 ) ;
180180 } ) ;
181-
182- test ( 'ignoreSentryErrors - with successful handler' , async ( ) => {
183- const sentryError = new SentryError ( 'HTTP Error (429)' ) ;
184- jest . spyOn ( Sentry , 'flush' ) . mockRejectedValueOnce ( sentryError ) ;
185-
186- const handledError = new Error ( 'handled error, and we want to monitor it' ) ;
187- const expectedSuccessStatus = { status : 'success' , reason : 'we handled error, so success' } ;
188- const handler = ( ) => {
189- Sentry . captureException ( handledError ) ;
190- return Promise . resolve ( expectedSuccessStatus ) ;
191- } ;
192- const wrappedHandlerWithoutIgnoringSentryErrors = wrapHandler ( handler , { ignoreSentryErrors : false } ) ;
193- const wrappedHandlerWithIgnoringSentryErrors = wrapHandler ( handler , { ignoreSentryErrors : true } ) ;
194-
195- await expect ( wrappedHandlerWithoutIgnoringSentryErrors ( fakeEvent , fakeContext , fakeCallback ) ) . rejects . toThrow (
196- sentryError ,
197- ) ;
198- await expect ( wrappedHandlerWithIgnoringSentryErrors ( fakeEvent , fakeContext , fakeCallback ) ) . resolves . toBe (
199- expectedSuccessStatus ,
200- ) ;
201- } ) ;
202-
203- test ( 'ignoreSentryErrors - with failed handler' , async ( ) => {
204- const sentryError = new SentryError ( 'HTTP Error (429)' ) ;
205- jest . spyOn ( Sentry , 'flush' ) . mockRejectedValueOnce ( sentryError ) ;
206-
207- const criticalUnhandledError = new Error ( 'critical unhandled error ' ) ;
208- const handler = ( ) => Promise . reject ( criticalUnhandledError ) ;
209- const wrappedHandlerWithoutIgnoringSentryErrors = wrapHandler ( handler , { ignoreSentryErrors : false } ) ;
210- const wrappedHandlerWithIgnoringSentryErrors = wrapHandler ( handler , { ignoreSentryErrors : true } ) ;
211-
212- await expect ( wrappedHandlerWithoutIgnoringSentryErrors ( fakeEvent , fakeContext , fakeCallback ) ) . rejects . toThrow (
213- sentryError ,
214- ) ;
215- await expect ( wrappedHandlerWithIgnoringSentryErrors ( fakeEvent , fakeContext , fakeCallback ) ) . rejects . toThrow (
216- criticalUnhandledError ,
217- ) ;
218- } ) ;
219181 } ) ;
220182
221183 describe ( 'wrapHandler() on sync handler' , ( ) => {
0 commit comments