import { isConfirmAction , getLeaveAction } from './application_leave' ; import { AppLeaveActionType } from './types' ; describe ( 'isConfirmAction' , ( ) => { it ( 'returns true if action is confirm' , ( ) => { expect ( isConfirmAction ( { type : AppLeaveActionType . confirm , text : 'message' } ) ) . toEqual ( true ) ; } ) ; it ( 'returns false if action is default' , ( ) => { expect ( isConfirmAction ( { type : AppLeaveActionType . default } ) ) . toEqual ( false ) ; } ) ; } ) ; describe ( 'getLeaveAction' , ( ) => { it ( 'returns the default action provided by the handler' , ( ) => { expect ( getLeaveAction ( ( actions ) => actions . default ( ) ) ) . toEqual ( { type : AppLeaveActionType . default , } ) ; } ) ; it ( 'returns the confirm action provided by the handler' , ( ) => { expect ( getLeaveAction ( ( actions ) => actions . confirm ( 'some message' ) ) ) . toEqual ( { type : AppLeaveActionType . confirm , text : 'some message' , } ) ; expect ( getLeaveAction ( ( actions ) => actions . confirm ( 'another message' , 'a title' ) ) ) . toEqual ( { type : AppLeaveActionType . confirm , text : 'another message' , title : 'a title' , } ) ; } ) ; } ) ;