diff --git a/ui/spec/shared/reducers/appSpec.js b/ui/spec/shared/reducers/appSpec.js new file mode 100644 index 0000000000..b238279bfb --- /dev/null +++ b/ui/spec/shared/reducers/appSpec.js @@ -0,0 +1,12 @@ +import {ephemeralReducer, persistedReducer} from 'src/shared/reducers/app' +import {setAutoRefresh} from 'src/shared/actions/app' + +describe('Shared.Reducers.app.persisted', () => { + it('should handle SET_AUTOREFRESH', () => { + const initialState = {autoRefresh: 15000} + const milliseconds = 0 + + const reducedState = persistedReducer(initialState, setAutoRefresh(milliseconds)); + expect(reducedState.autoRefresh).to.equal(0); + }) +}) diff --git a/ui/src/shared/actions/app.js b/ui/src/shared/actions/app.js index f8939f408f..87c78706ad 100644 --- a/ui/src/shared/actions/app.js +++ b/ui/src/shared/actions/app.js @@ -1,6 +1,6 @@ import {PRESENTATION_MODE_ANIMATION_DELAY} from '../constants' -// ephemeral state reducers +// ephemeral state action creators export const enablePresentationMode = () => ({ type: 'ENABLE_PRESENTATION_MODE', }) @@ -13,7 +13,7 @@ export const delayEnablePresentationMode = () => (dispatch) => { setTimeout(() => dispatch(enablePresentationMode()), PRESENTATION_MODE_ANIMATION_DELAY) } -// persistent state reducers +// persistent state action creators export const setAutoRefresh = (milliseconds) => ({ type: 'SET_AUTOREFRESH', payload: { diff --git a/ui/src/shared/reducers/app.js b/ui/src/shared/reducers/app.js index adcb4c2428..c8bc89ec90 100644 --- a/ui/src/shared/reducers/app.js +++ b/ui/src/shared/reducers/app.js @@ -16,7 +16,7 @@ const { persisted: initialPersistedState, } = initialState -const ephemeralReducer = (state = initialEphemeralState, action) => { +export const ephemeralReducer = (state = initialEphemeralState, action) => { switch (action.type) { case 'ENABLE_PRESENTATION_MODE': { return { @@ -37,7 +37,7 @@ const ephemeralReducer = (state = initialEphemeralState, action) => { } } -const persistedReducer = (state = initialPersistedState, action) => { +export const persistedReducer = (state = initialPersistedState, action) => { switch (action.type) { case 'SET_AUTOREFRESH': { return {