import { Component , Leaf , Composite , } from '../src/composite' ; test ( 'composite.ts -> Composite' , ( ) => { const composite = new Composite ( ) ; const compositeLeaves = [ new Leaf ( ) , new Leaf ( ) , new Leaf ( ) ] ; compositeLeaves . forEach ( ( leaf ) => composite . add ( leaf ) ) ; expect ( composite . operation ( ) ) . toEqual ( 'Leaf Leaf Leaf' ) ; const root = new Composite ( ) ; const rootLeaves = [ composite , new Leaf ( ) , new Leaf ( ) ] ; rootLeaves . forEach ( ( leaf ) => root . add ( leaf ) ) ; expect ( root . operation ( ) ) . toEqual ( 'Leaf Leaf Leaf Leaf Leaf' ) ; } ) ;