Add test for autoRefresh reducer
parent
2751a00813
commit
80e6e14b0d
|
@ -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);
|
||||
})
|
||||
})
|
|
@ -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: {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue