@@ -11,7 +11,6 @@ import {
1111 fill ,
1212 markFunctionWrapped ,
1313 objectify ,
14- unwrapMethod ,
1514 wrapMethod ,
1615} from '../../../src/utils/object' ;
1716import { testOnlyIfNodeVersionAtLeast } from '../../testutils' ;
@@ -458,16 +457,14 @@ describe('markFunctionWrapped', () => {
458457 } ) ;
459458} ) ;
460459
461- describe ( 'unwrapMethod, wrapMethod' , ( ) => {
460+ describe ( 'wrapMethod' , ( ) => {
462461 it ( 'can wrap a method on an object and unwrap it later' , ( ) => {
463462 const wrapped = ( ) => { } ;
464463 const original = ( ) => { } ;
465464 const obj = { m : original } ;
466465 wrapMethod ( obj , 'm' , wrapped ) ;
467466 expect ( obj . m ) . toBe ( wrapped ) ;
468467 expect ( ( obj . m as WrappedFunction ) . __sentry_original__ ) . toBe ( original ) ;
469- unwrapMethod ( obj , 'm' ) ;
470- expect ( obj . m ) . toBe ( original ) ;
471468 } ) ;
472469
473470 it ( 'throws if misused' , ( ) => {
@@ -479,16 +476,8 @@ describe('unwrapMethod, wrapMethod', () => {
479476 //@ts -expect-error verify type checking prevents this mistake
480477 wrapMethod ( obj , 'foo' , wrapped ) ;
481478 } ) . toThrowError ( 'Cannot wrap method: foo is not a function' ) ;
482- expect ( ( ) => {
483- //@ts -expect-error verify type checking prevents this mistake
484- unwrapMethod ( obj , 'foo' ) ;
485- } ) . toThrowError ( 'Cannot unwrap method: foo is not a function' ) ;
486479 expect ( ( ) => {
487480 wrapMethod ( obj , 'm' , wrapped ) ;
488481 } ) . toThrowError ( 'Attempting to wrap method m multiple times' ) ;
489- unwrapMethod ( obj , 'm' ) ;
490- expect ( ( ) => {
491- unwrapMethod ( obj , 'm' ) ;
492- } ) . toThrowError ( 'Method m is not wrapped, and cannot be unwrapped' ) ;
493482 } ) ;
494483} ) ;
0 commit comments