Skip to content

Commit 0a28e4f

Browse files
committed
fix(review): implement review suggestions
1 parent 03109a9 commit 0a28e4f

4 files changed

Lines changed: 4 additions & 12 deletions

File tree

src/redux/actions/App.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ export const setWidgetVersion = (version) => ({
1212
export const dispatcher = (dispatch) => ({
1313
markSessionTimedOut: () => dispatch({ type: ActionTypes.SESSION_IS_TIMED_OUT }),
1414
handleHumanEvent: () => dispatch({ type: ActionTypes.HUMAN_EVENT_HAPPENED }),
15-
setWidgetVersion: (version) => dispatch(setWidgetVersion(version)),
1615
})

src/redux/actions/__tests__/app-test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ describe('app Dispatcher', () => {
1313
expectDispatch({ type: ActionTypes.SESSION_IS_TIMED_OUT })
1414
})
1515

16-
it('should dispatch SET_WIDGET_VERSION', () => {
17-
actions.setWidgetVersion('abc1234')
18-
expectDispatch({ type: ActionTypes.SET_WIDGET_VERSION, payload: 'abc1234' })
19-
})
20-
2116
it('should create SET_WIDGET_VERSION action', () => {
2217
expect(setWidgetVersion('abc1234')).toEqual({
2318
type: ActionTypes.SET_WIDGET_VERSION,

src/redux/reducers/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const markSessionTimedOut = (state) => ({ ...state, sessionIsTimedOut: true })
1313

1414
const handleHumanEvent = (state) => ({ ...state, humanEvent: true })
1515

16-
const setWidgetVersion = (state, action) => ({ ...state, version: action.payload || null })
16+
const setWidgetVersion = (state, action) => ({ ...state, version: action.payload })
1717

1818
export const app = (state = defaultState, action) => {
1919
switch (action.type) {

src/redux/reducers/__tests__/app-test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { ActionTypes } from 'src/redux/actions/App'
1+
import { ActionTypes, setWidgetVersion } from 'src/redux/actions/App'
22
import { app as reducer, defaultState } from 'src/redux/reducers/App'
33

4-
const { SESSION_IS_TIMED_OUT, SET_WIDGET_VERSION } = ActionTypes
4+
const { SESSION_IS_TIMED_OUT } = ActionTypes
55

66
describe('app reducers', () => {
77
it('should return the initial state', () => {
@@ -18,9 +18,7 @@ describe('app reducers', () => {
1818

1919
describe('SET_WIDGET_VERSION', () => {
2020
it('should store the widget version', () => {
21-
const action = { type: SET_WIDGET_VERSION, payload: 'abc1234' }
22-
23-
expect(reducer(undefined, action).version).toBe('abc1234')
21+
expect(reducer(undefined, setWidgetVersion('abc1234')).version).toBe('abc1234')
2422
})
2523
})
2624
})

0 commit comments

Comments
 (0)