import { ActionDirective } from './action.directive' ; describe ( 'ActionDirective' , ( ) => { let directive ; const routeMock = { navigate : jasmine . createSpy ( 'navigate' ) , parseUrl : ( ) => ( { root : { children : [ ] } } ) } ; const storeMock = { dispatch : jasmine . createSpy ( 'dispatch' ) } ; beforeEach ( ( ) => { directive = new ActionDirective ( routeMock , storeMock ) ; } ) ; it ( 'should navigate if action is route' , ( ) => { directive . action = { url : 'dummy' } ; directive . onClick ( ) ; expect ( routeMock . navigate ) . toHaveBeenCalled ( ) ; } ) ; it ( 'should dispatch store action' , ( ) => { directive . action = { click : { } } ; directive . onClick ( ) ; expect ( storeMock . dispatch ) . toHaveBeenCalled ( ) ; } ) ; } ) ;