Add test for autoRefresh reducer

pull/965/head
Jared Scheib 2017-03-03 16:57:05 -08:00
parent 2751a00813
commit 80e6e14b0d
3 changed files with 16 additions and 4 deletions

View File

@ -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);
})
})

View File

@ -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: {

View File

@ -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 {