import { Context , ConcreteStateA , ConcreteStateB , } from '../src/state' ; test ( 'state.ts -> ConcreteStateA' , ( ) => { const stateA = new ConcreteStateA ( ) ; const context = new Context ( stateA ) ; expect ( context . getState ( ) ) . toEqual ( 'ConcreteStateA' ) ; context . request ( ) ; expect ( context . getState ( ) ) . toEqual ( 'ConcreteStateB' ) ; } ) ; test ( 'state.ts -> ConcreteStateB' , ( ) => { const stateB = new ConcreteStateB ( ) ; const context = new Context ( stateB ) ; expect ( context . getState ( ) ) . toEqual ( 'ConcreteStateB' ) ; context . request ( ) ; expect ( context . getState ( ) ) . toEqual ( 'ConcreteStateA' ) ; } ) ;