import reducerConfig, { selectNavigationEnabled } from './navigation' const { reducer: navigationReducer } = reducerConfig const getStateMock = () => reducerConfig.initialState describe('navigationReducer', () => { describe('unknown action', () => { it('should not modify the state', () => { const state = getStateMock() const newState = navigationReducer(state, { type: 'nope' } as any) expect(state).toBe(newState) }) }) describe('alter navigation state', () => { it('should disable navigation state', () => { const state = navigationReducer(getStateMock(), { type: 'updateNavigationState', payload: { enabled: false, }, }) expect(selectNavigationEnabled(state)).toEqual(false) }) it('should enable navigation state', () => { const state = navigationReducer( { enabled: false }, { type: 'updateNavigationState', payload: { enabled: true, }, } ) expect(selectNavigationEnabled(state)).toEqual(true) }) }) })