@@ -625,9 +625,12 @@ describe('ApexMigration', () => {
625625 it ( 'should return empty array when class already implements only System.Callable' , ( ) => {
626626 // Arrange
627627 const mockFile = { name : 'TestClass.cls' , location : '/test/path' } ;
628- const callableInterface = new InterfaceImplements ( 'Callable' , 'System' ) ;
628+ // Use the actual callableInterface instance from apexMigration
629+ const callableInterface = ( apexMigration as any ) . callableInterface ;
629630 const mockParser = {
630- implementsInterfaces : new Map ( [ [ callableInterface , [ { startIndex : 10 , stopIndex : 25 , text : 'System.Callable' } ] ] ] ) ,
631+ implementsInterfaces : new Map ( [
632+ [ callableInterface , [ { startIndex : 10 , stopIndex : 25 , text : 'System.Callable' } ] ] ,
633+ ] ) ,
631634 hasCallMethodImplemented : true ,
632635 classDeclaration : { } ,
633636 } ;
@@ -642,7 +645,8 @@ describe('ApexMigration', () => {
642645 it ( 'should replace only VlocityOpenInterface2 with System.Callable' , ( ) => {
643646 // Arrange
644647 const mockFile = { name : 'TestClass.cls' , location : '/test/path' } ;
645- const vlocityOpenInterface2 = new InterfaceImplements ( 'VlocityOpenInterface2' , testNamespace ) ;
648+ // Use the actual vlocityOpenInterface2 instance from apexMigration
649+ const vlocityOpenInterface2 = ( apexMigration as any ) . vlocityOpenInterface2 ;
646650 const mockParser = {
647651 implementsInterfaces : new Map ( [
648652 [ vlocityOpenInterface2 , [ { startIndex : 10 , stopIndex : 45 , text : `${ testNamespace } .VlocityOpenInterface2` } ] ] ,
@@ -664,7 +668,8 @@ describe('ApexMigration', () => {
664668 it ( 'should replace only VlocityOpenInterface with System.Callable' , ( ) => {
665669 // Arrange
666670 const mockFile = { name : 'TestClass.cls' , location : '/test/path' } ;
667- const vlocityOpenInterface = new InterfaceImplements ( 'VlocityOpenInterface' , testNamespace ) ;
671+ // Use the actual vlocityOpenInterface instance from apexMigration
672+ const vlocityOpenInterface = ( apexMigration as any ) . vlocityOpenInterface ;
668673 const mockParser = {
669674 implementsInterfaces : new Map ( [
670675 [ vlocityOpenInterface , [ { startIndex : 10 , stopIndex : 44 , text : `${ testNamespace } .VlocityOpenInterface` } ] ] ,
@@ -686,8 +691,9 @@ describe('ApexMigration', () => {
686691 it ( 'should replace BOTH VlocityOpenInterface and VlocityOpenInterface2 with System.Callable' , ( ) => {
687692 // Arrange - This is the FIX scenario
688693 const mockFile = { name : 'TestClass.cls' , location : '/test/path' } ;
689- const vlocityOpenInterface = new InterfaceImplements ( 'VlocityOpenInterface' , testNamespace ) ;
690- const vlocityOpenInterface2 = new InterfaceImplements ( 'VlocityOpenInterface2' , testNamespace ) ;
694+ // Use the actual interface instances from apexMigration
695+ const vlocityOpenInterface = ( apexMigration as any ) . vlocityOpenInterface ;
696+ const vlocityOpenInterface2 = ( apexMigration as any ) . vlocityOpenInterface2 ;
691697 const mockParser = {
692698 implementsInterfaces : new Map ( [
693699 [ vlocityOpenInterface , [ { startIndex : 10 , stopIndex : 44 , text : `${ testNamespace } .VlocityOpenInterface` } ] ] ,
@@ -711,8 +717,9 @@ describe('ApexMigration', () => {
711717 it ( 'should replace System.Callable with other interfaces to only System.Callable' , ( ) => {
712718 // Arrange
713719 const mockFile = { name : 'TestClass.cls' , location : '/test/path' } ;
714- const callableInterface = new InterfaceImplements ( 'Callable' , 'System' ) ;
715- const vlocityOpenInterface2 = new InterfaceImplements ( 'VlocityOpenInterface2' , testNamespace ) ;
720+ // Use the actual interface instances from apexMigration
721+ const callableInterface = ( apexMigration as any ) . callableInterface ;
722+ const vlocityOpenInterface2 = ( apexMigration as any ) . vlocityOpenInterface2 ;
716723 const mockParser = {
717724 implementsInterfaces : new Map ( [
718725 [ callableInterface , [ { startIndex : 10 , stopIndex : 25 , text : 'System.Callable' } ] ] ,
@@ -736,9 +743,10 @@ describe('ApexMigration', () => {
736743 it ( 'should replace BOTH Vlocity interfaces AND System.Callable with only System.Callable' , ( ) => {
737744 // Arrange - This is the FIX scenario with Callable already present
738745 const mockFile = { name : 'TestClass.cls' , location : '/test/path' } ;
739- const callableInterface = new InterfaceImplements ( 'Callable' , 'System' ) ;
740- const vlocityOpenInterface = new InterfaceImplements ( 'VlocityOpenInterface' , testNamespace ) ;
741- const vlocityOpenInterface2 = new InterfaceImplements ( 'VlocityOpenInterface2' , testNamespace ) ;
746+ // Use the actual interface instances from apexMigration
747+ const callableInterface = ( apexMigration as any ) . callableInterface ;
748+ const vlocityOpenInterface = ( apexMigration as any ) . vlocityOpenInterface ;
749+ const vlocityOpenInterface2 = ( apexMigration as any ) . vlocityOpenInterface2 ;
742750 const mockParser = {
743751 implementsInterfaces : new Map ( [
744752 [ callableInterface , [ { startIndex : 10 , stopIndex : 25 , text : 'System.Callable' } ] ] ,
@@ -763,7 +771,8 @@ describe('ApexMigration', () => {
763771 it ( 'should not add call method when it already exists' , ( ) => {
764772 // Arrange
765773 const mockFile = { name : 'TestClass.cls' , location : '/test/path' } ;
766- const vlocityOpenInterface2 = new InterfaceImplements ( 'VlocityOpenInterface2' , testNamespace ) ;
774+ // Use the actual vlocityOpenInterface2 instance from apexMigration
775+ const vlocityOpenInterface2 = ( apexMigration as any ) . vlocityOpenInterface2 ;
767776 const mockParser = {
768777 implementsInterfaces : new Map ( [
769778 [ vlocityOpenInterface2 , [ { startIndex : 10 , stopIndex : 45 , text : `${ testNamespace } .VlocityOpenInterface2` } ] ] ,
@@ -785,8 +794,9 @@ describe('ApexMigration', () => {
785794 it ( 'should handle both Vlocity interfaces when call method already exists' , ( ) => {
786795 // Arrange
787796 const mockFile = { name : 'TestClass.cls' , location : '/test/path' } ;
788- const vlocityOpenInterface = new InterfaceImplements ( 'VlocityOpenInterface' , testNamespace ) ;
789- const vlocityOpenInterface2 = new InterfaceImplements ( 'VlocityOpenInterface2' , testNamespace ) ;
797+ // Use the actual interface instances from apexMigration
798+ const vlocityOpenInterface = ( apexMigration as any ) . vlocityOpenInterface ;
799+ const vlocityOpenInterface2 = ( apexMigration as any ) . vlocityOpenInterface2 ;
790800 const mockParser = {
791801 implementsInterfaces : new Map ( [
792802 [ vlocityOpenInterface , [ { startIndex : 10 , stopIndex : 44 , text : `${ testNamespace } .VlocityOpenInterface` } ] ] ,
0 commit comments