import { Context , AddStrategy , SubtractStrategy , } from '../src/strategy' ; test ( 'strategy.ts -> AddStrategy' , ( ) => { const addStrategy = new AddStrategy ( ) ; const context = new Context ( addStrategy ) ; expect ( context . execute ( 1 , 2 ) ) . toEqual ( 3 ) ; context . setStrategy ( addStrategy ) ; expect ( context . execute ( 1 , 2 ) ) . toEqual ( 3 ) ; } ) ; test ( 'strategy.ts -> SubtractStrategy' , ( ) => { const subtractStrategy = new SubtractStrategy ( ) ; const context = new Context ( subtractStrategy ) ; expect ( context . execute ( 1 , 2 ) ) . toEqual ( - 1 ) ; context . setStrategy ( subtractStrategy ) ; expect ( context . execute ( 1 , 2 ) ) . toEqual ( - 1 ) ; } ) ;