diff --git a/src/discussions/tours/data/redux.test.js b/src/discussions/tours/data/redux.test.js index 34103bab..23843086 100644 --- a/src/discussions/tours/data/redux.test.js +++ b/src/discussions/tours/data/redux.test.js @@ -153,11 +153,10 @@ describe('toursReducer', () => { it('handles the updateUserDiscussionsTourSuccess action', () => { const initialState = { - tours: { - tours: [{ id: 1 }, { id: 2 }], - loading: true, - error: null, - }, + tours: [ + { id: 1 }, + { id: 2 }, + ], }; const updatedTour = { id: 2, @@ -165,11 +164,7 @@ describe('toursReducer', () => { }; const state = toursReducer(initialState, updateUserDiscussionsTourSuccess(updatedTour)); expect(state.tours) - .toEqual({ - tours: [{ id: 1 }, updatedTour], - loading: RequestStatus.SUCCESSFUL, - error: null, - }); + .toEqual([{ id: 1 }, updatedTour]); }); it('handles the discussionsToursRequestError action', () => { diff --git a/src/discussions/tours/data/slices.js b/src/discussions/tours/data/slices.js index ed8a9889..1fd34d0b 100644 --- a/src/discussions/tours/data/slices.js +++ b/src/discussions/tours/data/slices.js @@ -26,10 +26,10 @@ const userDiscussionsToursSlice = createSlice({ state.error = action.payload; }, updateUserDiscussionsTourSuccess: (state, action) => { - const tourIndex = state.tours.tours.findIndex(tour => tour.id === action.payload.id); - state.tours.tours[tourIndex] = action.payload; - state.tours.loading = RequestStatus.SUCCESSFUL; - state.tours.error = null; + const tourIndex = state.tours.findIndex(tour => tour.id === action.payload.id); + state.tours[tourIndex] = action.payload; + state.loading = RequestStatus.SUCCESSFUL; + state.error = null; }, }, });