File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export class ObjectPropertyCodeRetriever {
17
17
const gx = new RegExp ( `^(async)?\\s{0,}\\*?${ prop } ` ) ;
18
18
const isMethod = gx . test ( fnStr ) ;
19
19
return `
20
- ${ isMethod ? fnStr : `${ prop } : ${ fnStr } ` }
20
+ ${ isMethod ? fnStr : `" ${ prop } " : ${ fnStr } ` }
21
21
` ;
22
22
}
23
23
return '' ;
Original file line number Diff line number Diff line change @@ -837,6 +837,30 @@ cases.forEach(testData => {
837
837
expect ( mocked ) . toBeDefined ( ) ;
838
838
} ) ;
839
839
} ) ;
840
+
841
+ describe ( "method names with special chars" , ( ) => {
842
+ class TestClass {
843
+ "special_chars-@?" = ( ) => {
844
+ // do nothing
845
+ }
846
+ }
847
+
848
+ const TestObject = {
849
+ "special_chars-@?" : ( ) => {
850
+ // do nothing
851
+ }
852
+ }
853
+
854
+ it ( "should mock class" , ( ) => {
855
+ const mocked = mock ( TestClass ) ;
856
+ expect ( mocked ) . toBeDefined ( ) ;
857
+ } ) ;
858
+
859
+ it ( "should mock object" , ( ) => {
860
+ const mocked = mock ( TestObject ) ;
861
+ expect ( mocked ) . toBeDefined ( ) ;
862
+ } ) ;
863
+ } ) ;
840
864
} ) ;
841
865
} ) ;
842
866
You can’t perform that action at this time.
0 commit comments