Skip to content

Commit

Permalink
test: Add stories reducer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel committed Feb 27, 2020
1 parent 95922a2 commit 5689954
Show file tree
Hide file tree
Showing 2 changed files with 642 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/assets/javascripts/reducers/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const storiesReducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.RECEIVE_STORIES:
return {
...state,
[action.from]: action.data
...state,
[action.from]: action.data
};
case actionTypes.RECEIVE_PAST_STORIES:
return {
...state,
[action.from]: [ ...state[action.from], ...action.stories]
[action.from]: [...state[action.from], ...action.stories]
};
case actionTypes.CREATE_STORY:
const newStory = createNewStory(state[action.from], action.attributes);
Expand Down Expand Up @@ -72,7 +72,7 @@ const storiesReducer = (state = initialState, action) => {
updateIfSameId(action.story.id, story =>
addNewAttributes(story, { ...action.story, needsToSave: false })
))
})
})
case actionTypes.STORY_FAILURE:
return {
...state,
Expand Down Expand Up @@ -130,9 +130,9 @@ const storiesReducer = (state = initialState, action) => {
...state,
[action.from]: state[action.from].map(story => {
return story.id === action.storyId
? { ...story, highlighted: action.highlighted }
: story
})
? { ...story, highlighted: action.highlighted }
: story
})
}
case actionTypes.DELETE_NOTE:
return {
Expand Down

0 comments on commit 5689954

Please sign in to comment.