import { Events } from '../events' ; import { Loading } from './loading.reducer' ; describe ( 'Loading' , ( ) => { it ( 'Should return true if action is Events.LOADING_STARTED' , ( ) => { const stateMock = Symbol ( 'state' ) as unknown as boolean ; const actionMock = { type : Events . LOADING_STARTED } ; const result = Loading ( stateMock , actionMock ) ; expect ( result ) . toBe ( true ) ; } ) ; it ( 'Should return false if action is Events.LOADING_COMPLETED' , ( ) => { const stateMock = Symbol ( 'state' ) as unknown as boolean ; const actionMock = { type : Events . LOADING_COMPLETED } ; const result = Loading ( stateMock , actionMock ) ; expect ( result ) . toBe ( false ) ; } ) ; it ( 'Should return inputed state if action is none of the above' , ( ) => { const stateMock = Symbol ( 'state' ) as unknown as boolean ; const actionMock = { type : 'random value' } ; const result = Loading ( stateMock , actionMock ) ; expect ( result ) . toBe ( stateMock ) ; } ) ; it ( 'Should return true if action is Events.LOADING_STARTED and state omitted' , ( ) => { const stateMock = undefined ; const actionMock = { type : Events . LOADING_STARTED } ; const result = Loading ( stateMock , actionMock ) ; expect ( result ) . toBe ( true ) ; } ) ; it ( 'Should return false if action is Events.LOADING_COMPLETED and state omitted' , ( ) => { const stateMock = undefined ; const actionMock = { type : Events . LOADING_COMPLETED } ; const result = Loading ( stateMock , actionMock ) ; expect ( result ) . toBe ( false ) ; } ) ; it ( 'Should return inputed state if action is none of the above and state omitted' , ( ) => { const stateMock = undefined ; const actionMock = { type : 'random value' } ; const result = Loading ( stateMock , actionMock ) ; expect ( result ) . toBe ( false ) ; } ) ; } ) ;