@@ -682,12 +682,24 @@ describe('SAFE: separateChainedDeclarators', async () => {
682
682
} ) ;
683
683
describe ( 'SAFE: simplifyCalls' , async ( ) => {
684
684
const targetModule = ( await import ( '../src/modules/safe/simplifyCalls.js' ) ) . default ;
685
- it ( 'TP-1' , ( ) => {
685
+ it ( 'TP-1: With args ' , ( ) => {
686
686
const code = `func1.apply(this, [arg1, arg2]); func2.call(this, arg1, arg2);` ;
687
687
const expected = `func1(arg1, arg2);\nfunc2(arg1, arg2);` ;
688
688
const result = applyModuleToCode ( code , targetModule ) ;
689
689
assert . strictEqual ( result , expected ) ;
690
690
} ) ;
691
+ it ( 'TP-2: Without args' , ( ) => {
692
+ const code = `func1.apply(this); func2.call(this);` ;
693
+ const expected = `func1();\nfunc2();` ;
694
+ const result = applyModuleToCode ( code , targetModule ) ;
695
+ assert . strictEqual ( result , expected ) ;
696
+ } ) ;
697
+ it ( 'TN-1: Ignore calls without ThisExpression' , ( ) => {
698
+ const code = `func1.apply({}); func2.call(null);` ;
699
+ const expected = code ;
700
+ const result = applyModuleToCode ( code , targetModule ) ;
701
+ assert . strictEqual ( result , expected ) ;
702
+ } ) ;
691
703
} ) ;
692
704
describe ( 'SAFE: simplifyIfStatements' , async ( ) => {
693
705
const targetModule = ( await import ( '../src/modules/safe/simplifyIfStatements.js' ) ) . default ;
0 commit comments