import { MonkeyHandler , SquirrelHandler , DogHandler , } from '../src/chain-of-responsibility' ; const monkey = new MonkeyHandler ( ) ; const squirrel = new SquirrelHandler ( ) ; const dog = new DogHandler ( ) ; monkey . setNext ( squirrel ) . setNext ( dog ) ; test ( 'chain-of-responsibility.ts -> MonkeyHandler' , ( ) => { expect ( monkey . handle ( 'Banana' ) ) . toEqual ( 'Monkey: I\'ll eat the Banana.' ) ; } ) ; test ( 'chain-of-responsibility.ts -> SquirrelHandler' , ( ) => { expect ( monkey . handle ( 'Nut' ) ) . toEqual ( 'Squirrel: I\'ll eat the Nut.' ) ; } ) ; test ( 'chain-of-responsibility.ts -> DogHandler' , ( ) => { expect ( monkey . handle ( 'MeatBall' ) ) . toEqual ( 'Dog: I\'ll eat the MeatBall.' ) ; } ) ; test ( 'chain-of-responsibility.ts -> Unhandled' , ( ) => { expect ( monkey . handle ( 'Cup of coffee' ) ) . toBeUndefined ( ) ; } ) ;