@@ -16,7 +16,10 @@ test('does not warn when rest object is empty', () => {
1616} ) ;
1717
1818test ( 'warns when unknown option is passed' , ( ) => {
19- validateOptions ( 'testFunction' , { unknownOption : 'value' } , testFunction ) ;
19+ function testFunctionWithCall ( ) {
20+ validateOptions ( 'testFunction' , { unknownOption : 'value' } , testFunctionWithCall ) ;
21+ }
22+ testFunctionWithCall ( ) ;
2023
2124 expect ( _console . warn ) . toHaveBeenCalledTimes ( 1 ) ;
2225 const warningMessage = jest . mocked ( _console . warn ) . mock . calls [ 0 ] [ 0 ] ;
@@ -25,11 +28,14 @@ test('warns when unknown option is passed', () => {
2528} ) ;
2629
2730test ( 'warns when multiple unknown options are passed' , ( ) => {
28- validateOptions (
29- 'testFunction' ,
30- { option1 : 'value1' , option2 : 'value2' , option3 : 'value3' } ,
31- testFunction ,
32- ) ;
31+ function testFunctionWithCall ( ) {
32+ validateOptions (
33+ 'testFunction' ,
34+ { option1 : 'value1' , option2 : 'value2' , option3 : 'value3' } ,
35+ testFunctionWithCall ,
36+ ) ;
37+ }
38+ testFunctionWithCall ( ) ;
3339
3440 expect ( _console . warn ) . toHaveBeenCalledTimes ( 1 ) ;
3541 const warningMessage = jest . mocked ( _console . warn ) . mock . calls [ 0 ] [ 0 ] ;
@@ -41,9 +47,9 @@ test('warns when multiple unknown options are passed', () => {
4147
4248test ( 'warns with correct function name and includes stack trace' , ( ) => {
4349 function render ( ) {
44- // Test function
50+ validateOptions ( 'render' , { invalid : true } , render ) ;
4551 }
46- validateOptions ( ' render' , { invalid : true } , render ) ;
52+ render ( ) ;
4753
4854 expect ( _console . warn ) . toHaveBeenCalledTimes ( 1 ) ;
4955 const warningMessage = jest . mocked ( _console . warn ) . mock . calls [ 0 ] [ 0 ] ;
0 commit comments